Most of the bloggers add 'load more posts' button in their blog (website). Some bloggers like to add 'infinite scrolling' which is an advanced form of load more button. Both things perform the same action but the only difference is that you have to press 'load more' button manually, while on the other hand, 'infinite scrolling' do it for you with an automatic system. Basically, this is done with a jQuery script.
It's working phenomenon is quite simple. Let me explain here one by one. If you apply a 'load more posts' button to your blog, the readers have to click on this button, again and again, to load older posts until the last post. If we talk about 'infinite scrolling', it loads your older posts when a reader scroll down the page and there is no need to press any button manually for this purpose. Blogger always tries to make their blog more attractive by designing social share buttons with font awesome icons.
How To Add Load More Posts Button in Blogger
Now we should move forward to the actual process to get the desired results. The only thing you have to do is the addition of given code to your source code. Here are simple steps to do it easily.
1. Sign in to your blogger account and choose the desired blog.
2. Click on "Template" and go to "Edit HTML"
3. Click anywhere in the coding area and press 'Ctrl + F' on the keyboard (Mac users will press 'Command + F').
4. A search bar will appear in coding section. In this bar, type "</head>".
5. Now copy the given code and paste it just above the </head> tag.
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'/><b:if cond='data:blog.pageType != "static_page"'><b:if cond='data:blog.pageType != "item"'><script type='text/javascript'>//<![CDATA[!function(a){function b(){h||(h=!0,d?(f.find("a").hide(),f.find("img").show(),a.ajax(d,{dataType:"html"}).done(function(b){var b=a("<div></div>").append(b.replace(k,"")),c=b.find("a.blog-pager-older-link");c?d=c.attr("href"):(d="",f.hide());b=b.find(g).children();a(g).append(b),window._gaq&&window._gaq.push(["_trackPageview",d]);window.gapi&&window.gapi.plusone&&window.gapi.plusone.go&&window.gapi.plusone.go();window.disqus_shortname&&a.getScript("http://"+window.disqus_shortname+".disqus.com/
blogger_index.js");window.FB&&window.FB.XFBML&&window.FB.XFBML.parse&&window.
FB.XFBML.parse();f.find("img").hide();f.find("a").show();h=!1})):f.hide())}function c(){var a=Math.max(i.height(),j.height(),document.documentElement.clientHeight),c=i.scrollTop()+i.height()
;0>a-c&&b()}var d="",f=null,g="div.blog-posts",h=!1,i=a(window),j=a(document),k=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;a(document).ready(function(){if("item"!=_WidgetManager._GetAllData().blog.pageType&&(d=a("a.blog-pager-older-link").attr("href"))){var g=a('<a href="javascript:;" >LOAD MORE POSTS</a>');g.click(b);i.scroll(c);f=a('<div class="load-more"></div>');f.append(g);f.append(e);f.insertBefore(a("#blog-pager"));a("#blog-pager").hide()}})}(jQuery);//]]></script><style type="text/css">.load-more{display:block;text-align:center;margin:20px auto;}.load-more a,.load-more a:hover{text-decoration:none;font:bold 11px Open Sans, sans-serif;letter-spacing:1px;padding:10px 20px;background:#000000;color:#ffffff;}</style></b:if></b:if>
6. Click on 'Save Template' and check the results. Now a 'load more posts' button should appear on the homepage of your blog.
[Recommended: Add Stylish Headline News Widget In Your Blog]
How To Add Infinite Scrolling In Blogger
1. Follow the four steps as mentioned above to reach the </head> tag.
2. Now copy the given code and paste it just above the </head> tag.
<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'/><b:if cond='data:blog.pageType != "static_page"'><b:if cond='data:blog.pageType != "item"'><script type='text/javascript'>//<![CDATA[!function(a){function b(){h||(h=!0,d?(f.find("a").hide(),f.find("img").show(),a.ajax(d,{dataType:"html"}).done(function(b){var b=a("<div></div>").append(b.replace(k,"")),c=b.find("a.blog-pager-older-link");c?d=c.attr("href"):(d="",f.hide());b=b.find(g).children();a(g).append(b),window._gaq&&window._gaq.
push(["_trackPageview",d]);window.gapi&&window.gapi.plusone&&window.gapi.plusone.go&&window.gapi.plusone.go();window.disqus_shortname&&a.getScript("http://"
+window.disqus_shortname+".disqus.com/blogger_index.js");window.FB&&window.FB.XFBML&&window.FB.XFBML.parse&&window.FB.XFBML.parse();window.twttr&&window.twttr.widgets&&window.twttr.widgets.load&&window.twttr.widgets.load();f.find("img").hide();
f.find("a").show();h=!1})):f.hide())}function c(){var a=Math.max(i.height(),j.height(),document.documentElement.clientHeight),
c=i.scrollTop()+i.height();150>a-c&&b()}var d="",f=null,g="div.blog-posts",h=!1,i=a(window),j=a(document),k=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;a(document).ready(function(){if("item"!=_WidgetManager._GetAllData().blog.pageType&&(d=a("a.blog-pager-older-link").attr("href"))){var g=a('<a href="javascript:;" >LOAD MORE POSTS</a>');g.click(b);i.scroll(c);f=a('<div class="load-more"></div>');f.append(g);f.append(e);f.insertBefore(a("#blog-pager"));a("#blog-pager").hide()}})}(jQuery);//]]></script></b:if></b:if>
3. Click on 'Save Template' and check the results. Now your blog will show the older posts with the scrolling of page just like in Facebook or Twitter.
[You may like to make Author's Comment Box Prominent In Your Blog]
Modifications
You can see a red line in the code. This red line is to use jQuery libraries. So, if you have already added jQuery in your template then please remove this red line because the doubling of this script may cause issues with your website. Here is a step by step guide to check either you already have this or not.
- Go to your "Template" >> "Edit HTML" and search for jquery.min.js or jquery.js
- If you already have, it should look like "<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js'/>"
- Here the version number is 2.2.0. It may be different in the previous script but you can replace this number with another number.
Bottom Line
Okay, you have done a good job. Now you and your visitors can see load more button/infinite scrolling on your website. Post your comments below to give valued feedback or ask a question in the case of any confusion.
Hi Monim, Hope you are doing great. i tried all options to add infinite scroll to my blogger blog with custom template . However, it's not working on my blog. can you please help me to fix it. My blog: lookbook.tikli.in - Tikli . Your help is highly appreciated :)
ReplyDeleteHi Tikli, I am sorry if this script didn't work for you. However, it was good experience for me to use it and it was working amazingly.
DeleteAnyway, make sure you are using responsive and dynamic template. In other case, I will refer to this Video Guide in this regard.
Thanks :)
bhai jan ma ny aap ka blogger cource tuturiol dakha tha us main bloger create kia sub complete kr lia lekin jo bhi post krta hon wo home main jati hain bqi main nahi mean agar main software main koi software post krna chahu to kis tarha kru ga or agar videos main krna chahu to kis tarha kru ga
ReplyDelete@ Entertainment World
DeleteYou just need to give a proper tag to each of your posts. These tags will automatically generate a URL link. Now, click on any desired tag >> copy the corresponding URL >> Paste it to the menu in Layout/Theme (According to your template). It's done. Thanks
can u send me screenshot please i dont understand because i dont understand english can u tell me in urdu please please replied i m waiting
Deleteyar urdu main batain aap english ma samajh nahi aay gi q k ap ka tuturial bht best tha blogger ka complete cource sub samajh aa gai but yhi ik main problem reh gai hai kch bhi post kro home main please aap urdu main bata dain
ReplyDeletethanks
@Entertainment World:
DeleteOkay bro ap es mail py rabta kro, chandgoraya4@gmail.com
I will respond you as soon as possible.