Related Post Plugin Blogger Code
Related Post Plugin Blogger Code

Related Post Plugin Blogger Code

Hello friends today we will tell you how we can install related post plugin in blogger i.e Related Post Plugin Blogger Code. You read my post carefully, this code will 100% help you to install related post plugin in blogger.

नमस्कार दोस्तों आज हम आपको बताएंगे कि किस प्रकार से ब्लॉगर में हम रिलेटेड पोस्ट प्लग इन लगा सकते हैं i.e Related Post Plugin Blogger Code
आप मेरी पोस्ट को ध्यान से पढ़े ये कोड 100% ब्लॉगर में रिलेटेड पोस्ट प्लग इन लगाने में आपकी मदद करेंगा | 
In this we will tell you simple three steps, you see these steps carefully. (इसमें हम आपको सिंपल तीन स्टेप्स बतांगे आप इन स्टेप्स को ध्यान से देखे )

Step 1 :- Related Post Plugin Blogger Code

                               Add JavaScript Code After </body> in Blogger Template Theme.
Paste Code Script below </body>

<script type='text/javascript'>

//<![CDATA[

imgr=new Array();imgr[0]="https://blogger.googleusercontent.com/img/a/AVvXsEjycGvXPW8ckOngRNt3Ps8tKprZMN9YCKUWJqXACozM4ffIfO_36R0SVbVr8C-Bn1VljMkee95kA0rFxCfhddlWwwpM8htdknNKnKo--bCQv0YMTGSMnNO-_FUd63LHjPc9OtmmC8NdWB1-Mp5ZTxVoY_7iW5VAWuXNvkAZQfeDOMPOK23feC2JCmrPwg=s320";showRandomImg=true;aBold=true;summaryPost=400;summaryTitle=20;numposts1=12;numposts2=4;function removeHtmlTag(strx,chop){var s=strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i]=s[i].substring(s[i].indexOf(">")+1,s[i].length)}}s=s.join("");s=s.substring(0,chop-1);return s}

  function showrecentposts1(json){j=(showRandomImg)?Math.floor((imgr.length+1)*Math.random()):0;img=new Array();if(numposts2<=json.feed.entry.length){maxpost=numposts2}else{maxpost=json.feed.entry.length}for(var i=0;i<maxpost;i++){var entry=json.feed.entry[i];var posttitle=entry.title.$t;var pcm;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='replies'&&entry.link[k].type=='text/html'){pcm=entry.link[k].title.split(" ")[0];break}}if("content"in entry){var postcontent=entry.content.$t}else if("summary"in entry){var postcontent=entry.summary.$t}else var postcontent="";postdate=entry.published.$t;if(j>imgr.length-1)j=0;img[i]=imgr[j];s=postcontent;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!=""))img[i]=d;var month=[1,2,3,4,5,6,7,8,9,10,11,12];var month2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var day=postdate.split("-")[2].substring(0,2);var m=postdate.split("-")[1];var y=postdate.split("-")[0];for(var u2=0;u2<month.length;u2++){if(parseInt(m)==month[u2]){m=month2[u2];break}}var daystr=day+' '+m+' '+y;pcm='<a href="'+posturl+'">'+pcm+' comments</a>';var trtd='<div class="col_maskolis"><h2 class="posttitle"><a href="'+posturl+'">'+posttitle+'</a></h2><a href="'+posturl+'"><img class="related_img" src="'+img[i]+'"/></a><div class="clear"></div></div>';document.write(trtd);j++}}var relatedTitles=new Array();var relatedTitlesNum=0;var relatedUrls=new Array();var thumburl=new Array();function related_results_labels_thumbs(json){for(var i=0;i<json.feed.entry.length;i++){var entry=json.feed.entry[i];relatedTitles[relatedTitlesNum]=entry.title.$t;try{thumburl[relatedTitlesNum]=entry.gform_foot.url}catch(error){s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){thumburl[relatedTitlesNum]=d}else thumburl[relatedTitlesNum]='https://blogger.googleusercontent.com/img/a/AVvXsEjycGvXPW8ckOngRNt3Ps8tKprZMN9YCKUWJqXACozM4ffIfO_36R0SVbVr8C-Bn1VljMkee95kA0rFxCfhddlWwwpM8htdknNKnKo--bCQv0YMTGSMnNO-_FUd63LHjPc9OtmmC8NdWB1-Mp5ZTxVoY_7iW5VAWuXNvkAZQfeDOMPOK23feC2JCmrPwg=s320'}for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){relatedUrls[relatedTitlesNum]=entry.link[k].href;relatedTitlesNum++}}}}function removeRelatedDuplicates_thumbs(){var tmp=new Array(0);var tmp2=new Array(0);var tmp3=new Array(0);for(var i=0;i<relatedUrls.length;i++){if(!contains_thumbs(tmp,relatedUrls[i])){tmp.length+=1;tmp[tmp.length-1]=relatedUrls[i];tmp2.length+=1;tmp3.length+=1;tmp2[tmp2.length-1]=relatedTitles[i];tmp3[tmp3.length-1]=thumburl[i]}}relatedTitles=tmp2;relatedUrls=tmp;thumburl=tmp3}function contains_thumbs(a,e){for(var j=0;j<a.length;j++)if(a[j]==e)return true;return false}function printRelatedLabels_thumbs(){for(var i=0;i<relatedUrls.length;i++){if((relatedUrls[i]==currentposturl)||(!(relatedTitles[i]))){relatedUrls.splice(i,1);relatedTitles.splice(i,1);thumburl.splice(i,1);i--}}var r=Math.floor((relatedTitles.length-1)*Math.random());var i=0;if(relatedTitles.length>0)document.write('<h2>'+relatedpoststitle+'</h2>');document.write('<div style="clear: both;"/>');while(i<relatedTitles.length&&i<20&&i<maxresults){document.write('<a style="text-decoration:none; margin:10px; margin-buttom:20px;background-color:#bec1cc;border-radius:10px; ');if(i!=0)document.write('"');else document.write('"');document.write(' href="'+relatedUrls[r]+'"><img class="related_img" src="'+thumburl[r]+'"/><div id="related-title">'+relatedTitles[r]+'</div></a>');if(r<relatedTitles.length-1){r++}else{r=0}i++}document.write('</div>');relatedUrls.splice(0,relatedUrls.length);thumburl.splice(0,thumburl.length);relatedTitles.splice(0,relatedTitles.length)}

//]]>

</script>


Step 2 : Related Post Plugin Blogger Code

Add XML Code 
  • Go to Blogger i.e https://rkknotes.blogspot.com
  • Click on "Theme" show on Left side.
  • Click on "Edit Html" Showing in customize.
  • Search <div class=’post-footer-line post-footer-line-1′> or <div class='post-footer'>
  • Paste Code Script Below this div  <div class='post-footer'>
--------------------------------------------------------------------------------------------------------------
<b:if cond='data:blog.pageType == &quot;item&quot;'>
<div id='related-posts'>
<b:loop values='data:post.labels' var='label'>
<b:if cond='data:label.isLast != &quot;true&quot;'>
 </b:if>
        <b:if cond='data:blog.pageType == &quot;item&quot;'>
        <script expr:src='&quot;/feeds/posts/default/-/&quot; + data:label.name + &quot;?alt=json-in-script&amp;callback=related_results_labels_thumbs&amp;max-results=6&quot;' type='text/javascript'/></b:if><br/></b:loop>
        <script type='text/javascript'>
            var currentposturl=&quot;<data:post.url/>&quot;;
            var maxresults=3;
            var relatedpoststitle=&quot;<b>Related Posts:</b>&quot;;
            removeRelatedDuplicates_thumbs();
            printRelatedLabels_thumbs();
        </script>
    </div>
</b:if>
-------------------------------------------------------------------------------------------------------------

Step 3 : Related Post Plugin Blogger Code
Add CSS Code 
  • Go to Blogger i.e https://rkknotes.blogspot.com
  • Click on "Theme" show on Left side.
  • Click on "Edit Html" Showing in customize.
  • Search <head>
  • Paste Script code between <head> Your Script Code Here </head>
 <!--Related Posts with thumbnails Scripts and Styles Start-->
<style>
  .post-body img{width:90%; text-align:center;height:auto; !important}
  .mainArticles.entry-content p{
      line-height: 1.6;
    font-size: 17px;
    letter-spacing: 1px;
    word-spacing: 2px;
      }
  
#related-posts div{ 
  display:flex;
  flex-wrap: wrap;
  justify-content: space-around; 
}
  #related-posts a{ width:200px; back-ground-color:#c8c9cc;
  margin-bottom:20px;object-fit: cover;}
#related-posts h2 { 
   color:white;
  padding:10px;
  margin-top:20px;
  margin-bottom:20px;
  background-color: #333;
}
  
 div.tableRed{margin-top:20px;margin-bottom:20px;overflow:auto}div.tableRed table{min-width:600px;margin:auto}div.tableRed table tr th{background-color:#ff6347;color:#fff;padding:8px;font-size:22px;font-weight:700}div.tableRed table tr td{color:#000;background-color:#dbdbdb;padding:5px}a.linkMains{color:#fff;background-color:#000;padding:7px;font-size:18px;border-radius:10px;transition:.3s;margin-top:20px;margin-bottom:20px}a.linkMains:hover{background-color:#222}div.indexBox{background-color:#e6e6e6;padding:10px;max-width:400px;border-radius:20px;text-align:center;border:2px solid #8a2be2;margin:auto}div.indexBox a{display:block;color:#000;font-weight:800;padding:5px}div.indexBox a:hover{background-color:#d4d4d4}div.indexBox h2{text-transform:uppercase;color:#8a2be2;text-decoration:underline;margin-bottom:10px}
  
#related-posts .related_img { 
  display: block;
  margin-left: auto;
  margin-right: auto;
    object-fit: cover;
    width:100%;
  border-radius:10px 10px 0 0;
  height:100px;
    transition:all 300ms ease-in-out;
    -webkit-transition:all 300ms ease-in-out;
    -moz-transition:all 300ms ease-in-out;
    -o-transition:all 300ms ease-in-out;
    -ms-transition:all 300ms ease-in-out; 
  
}
   #related-posts .related_img:hover{
  opacity: 0.5;
  object-fit: cover;
  }
#related-title {
    color: black;
    line-height: 20px;
    padding: 0 10px;
  font-weight:700;
    padding:5px;
    
   
}
  
  123456789
@media only screen and (max-width: 450px) {
  #related-posts a{ width:70%;}
  }
 </style>
<script type='text/javascript'>
//<![CDATA[
imgr=new Array();imgr[0]="https://blogger.googleusercontent.com/img/a/AVvXsEjycGvXPW8ckOngRNt3Ps8tKprZMN9YCKUWJqXACozM4ffIfO_36R0SVbVr8C-Bn1VljMkee95kA0rFxCfhddlWwwpM8htdknNKnKo--bCQv0YMTGSMnNO-_FUd63LHjPc9OtmmC8NdWB1-Mp5ZTxVoY_7iW5VAWuXNvkAZQfeDOMPOK23feC2JCmrPwg=s320";showRandomImg=true;aBold=true;summaryPost=400;summaryTitle=20;numposts1=12;numposts2=4;function removeHtmlTag(strx,chop){var s=strx.split("<");for(var i=0;i<s.length;i++){if(s[i].indexOf(">")!=-1){s[i]=s[i].substring(s[i].indexOf(">")+1,s[i].length)}}s=s.join("");s=s.substring(0,chop-1);return s}
  function showrecentposts1(json){j=(showRandomImg)?Math.floor((imgr.length+1)*Math.random()):0;img=new Array();if(numposts2<=json.feed.entry.length){maxpost=numposts2}else{maxpost=json.feed.entry.length}for(var i=0;i<maxpost;i++){var entry=json.feed.entry[i];var posttitle=entry.title.$t;var pcm;var posturl;if(i==json.feed.entry.length)break;for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){posturl=entry.link[k].href;break}}for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='replies'&&entry.link[k].type=='text/html'){pcm=entry.link[k].title.split(" ")[0];break}}if("content"in entry){var postcontent=entry.content.$t}else if("summary"in entry){var postcontent=entry.summary.$t}else var postcontent="";postdate=entry.published.$t;if(j>imgr.length-1)j=0;img[i]=imgr[j];s=postcontent;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!=""))img[i]=d;var month=[1,2,3,4,5,6,7,8,9,10,11,12];var month2=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];var day=postdate.split("-")[2].substring(0,2);var m=postdate.split("-")[1];var y=postdate.split("-")[0];for(var u2=0;u2<month.length;u2++){if(parseInt(m)==month[u2]){m=month2[u2];break}}var daystr=day+' '+m+' '+y;pcm='<a href="'+posturl+'">'+pcm+' comments</a>';var trtd='<div class="col_maskolis"><h2 class="posttitle"><a href="'+posturl+'">'+posttitle+'</a></h2><a href="'+posturl+'"><img class="related_img" src="'+img[i]+'"/></a><div class="clear"></div></div>';document.write(trtd);j++}}var relatedTitles=new Array();var relatedTitlesNum=0;var relatedUrls=new Array();var thumburl=new Array();function related_results_labels_thumbs(json){for(var i=0;i<json.feed.entry.length;i++){var entry=json.feed.entry[i];relatedTitles[relatedTitlesNum]=entry.title.$t;try{thumburl[relatedTitlesNum]=entry.gform_foot.url}catch(error){s=entry.content.$t;a=s.indexOf("<img");b=s.indexOf("src=\"",a);c=s.indexOf("\"",b+5);d=s.substr(b+5,c-b-5);if((a!=-1)&&(b!=-1)&&(c!=-1)&&(d!="")){thumburl[relatedTitlesNum]=d}else thumburl[relatedTitlesNum]='https://blogger.googleusercontent.com/img/a/AVvXsEjycGvXPW8ckOngRNt3Ps8tKprZMN9YCKUWJqXACozM4ffIfO_36R0SVbVr8C-Bn1VljMkee95kA0rFxCfhddlWwwpM8htdknNKnKo--bCQv0YMTGSMnNO-_FUd63LHjPc9OtmmC8NdWB1-Mp5ZTxVoY_7iW5VAWuXNvkAZQfeDOMPOK23feC2JCmrPwg=s320'}for(var k=0;k<entry.link.length;k++){if(entry.link[k].rel=='alternate'){relatedUrls[relatedTitlesNum]=entry.link[k].href;relatedTitlesNum++}}}}function removeRelatedDuplicates_thumbs(){var tmp=new Array(0);var tmp2=new Array(0);var tmp3=new Array(0);for(var i=0;i<relatedUrls.length;i++){if(!contains_thumbs(tmp,relatedUrls[i])){tmp.length+=1;tmp[tmp.length-1]=relatedUrls[i];tmp2.length+=1;tmp3.length+=1;tmp2[tmp2.length-1]=relatedTitles[i];tmp3[tmp3.length-1]=thumburl[i]}}relatedTitles=tmp2;relatedUrls=tmp;thumburl=tmp3}function contains_thumbs(a,e){for(var j=0;j<a.length;j++)if(a[j]==e)return true;return false}function printRelatedLabels_thumbs(){for(var i=0;i<relatedUrls.length;i++){if((relatedUrls[i]==currentposturl)||(!(relatedTitles[i]))){relatedUrls.splice(i,1);relatedTitles.splice(i,1);thumburl.splice(i,1);i--}}var r=Math.floor((relatedTitles.length-1)*Math.random());var i=0;if(relatedTitles.length>0)document.write('<h2>'+relatedpoststitle+'</h2>');document.write('<div style="clear: both;"/>');while(i<relatedTitles.length&&i<20&&i<maxresults){document.write('<a style="text-decoration:none; margin:10px; margin-buttom:20px;background-color:#bec1cc;border-radius:10px; ');if(i!=0)document.write('"');else document.write('"');document.write(' href="'+relatedUrls[r]+'"><img class="related_img" src="'+thumburl[r]+'"/><div id="related-title">'+relatedTitles[r]+'</div></a>');if(r<relatedTitles.length-1){r++}else{r=0}i++}document.write('</div>');relatedUrls.splice(0,relatedUrls.length);thumburl.splice(0,thumburl.length);relatedTitles.splice(0,relatedTitles.length)}
//]]>
</script>
    <!--Related Posts with thumbnails Scripts and Styles End-->

After Applying these "3" Steps you can check your blog.

Related Post Plugin Blogger Code

Related Post Plugin Blogger Code


b