How to Change the Next Prev Blogspot Button with Numbers - Best Blogger Designs, Tips, Tricks, Tools and Basic to Advanced Training

Best Blogger Designs, Tips, Tricks, Tools and Basic to Advanced Training

Best Blogger Designs, Tips, Tricks, Tools, Basic to Advanced Training, Money Making Tips, SEO, Traffic Genaration Methods, Free Templates, Free Hosting Tricks

Hot

Post Top Ad

Your Ad Spot

How to Change the Next Prev Blogspot Button with Numbers

How to Change the Next Prev Blogspot Button with Numbers


One of the typical traits default template Blogger is the navigation button next prev (blog pager) between the item page and the home page that both still use three choices, namely old posts, new posts, and homepage. And the three navigation buttons will not change even though we have changed the standard template to be responsive . For that, I want to share how to make the next page button on the blog with numbers, or rather change the nextprev button Blogspot that already exists becomes a row of numbers or sequence number 1 2 3 and so on.

Next Prev Navigation


This next page number button will only appear on the main page, label, and archive. Where the page contains a list of articles which are divided into several pages containing a number of articles according to the specified amount. For Blogger default settings are 7 posts / articles per page. By changing the nextprev button with numbers, it will make the appearance of the blog look more beautiful and attractive. 

Before you follow the tutorial how to make the blogspot next page button become a number. It's good to backup / back up your blog template first. 

Also read:



1. As always, enter the Edit HTML template. 
2. Copy and paste the following CSS code above the code .]]></b:skin>

  1. .home-link {

  2. display: none;

  3. }

  4. #blog-pager {

  5. clear: both;

  6. text-align: center;

  7. padding: 15px 0;

  8. background: none;

  9. color: #4d4d4d;

  10. }

  11. .displaypageNum a,

  12. .showpage a,

  13. .pagecurrent, .blog-pager-older-link, .blog-pager-newer-link {

  14. padding: 5px 13px;

  15. margin-right: 8px;

  16. color: #2b2b2b;

  17. border:solid 2px #ebebeb;

  18. display: inline-block;

  19. line-height: 20px;

  20. -moz-border-radius: 2px;

  21. -webkit-border-radius: 2px;

  22. border-radius: 2px;

  23. margin-top: 10px;

  24. font-family:Oswald;

  25. }

  26. .displaypageNum a:hover,

  27. .showpage a:hover,

  28. .pagecurrent, .blog-pager-older-link:hover, .blog-pager-newer-link:hover {

  29. background: #47a7d7;

  30. text-decoration: none;

  31. color:#fff;

  32. }

  33. #blog-pager .showpage,

  34. #blog-pager {

  35. padding: 5px 10px;

  36. font: normal 13px arial;

  37. text-align: center;

  38. color: #000;

  39. float: center;

  40. }

  41. .showpageOf {

  42. display: none!important;

  43. overflow: hidden;

  44. }

  45. #blog-pager .pages {

  46. margin: 10px 0;

  47. border: none;

  48. }



3. Install the javascript code just above the code </body>.
<b:if cond='data:blog.pageType not in {&quot;static_page&quot;,&quot;item&quot;,&quot;error_page&quot;}'>
<script type="text/javascript">
  /*<![CDATA[*/
    var perPage=7;
    var numPages=5;
    var firstText ='First';
    var lastText ='Last';
    var prevText ='« Previous';
    var nextText ='Next »';
    var urlactivepage=location.href;
    var home_page="/";
  /*]]>*/
</script>
<script type="text/javascript">
 /*<![CDATA[*/
  if (typeof firstText == "undefined") firstText = "First";
  if (typeof lastText == "undefined") lastText = "Last";
  var noPage;
  var currentPage;
  var currentPageNo;
  var postLabel;
  pagecurrentg();

  function looppagecurrentg(pageInfo) {
      var html = '';
      pageNumber = parseInt(numPages / 2);
      if (pageNumber == numPages - pageNumber) {
          numPages = pageNumber * 2 + 1
      }
      pageStart = currentPageNo - pageNumber;
      if (pageStart < 1) pageStart = 1;
      lastPageNo = parseInt(pageInfo / perPage) + 1;
      if (lastPageNo - 1 == pageInfo / perPage) lastPageNo = lastPageNo - 1;
      pageEnd = pageStart + numPages - 1;
      if (pageEnd > lastPageNo) pageEnd = lastPageNo;
      html += "<span class='showpageOf'>Page " + currentPageNo + ' of ' + lastPageNo + "</span>";
      var prevNumber = parseInt(currentPageNo) - 1;

      //Iccsi was here, doing magic    
      if (currentPageNo > 1) {
          if (currentPage == "page") {
              html += '<span class="showpage firstpage"><a href="' + home_page + '">' + firstText + '</a></span>'
          } else {
              html += '<span class="displaypageNum firstpage"><a href="/search/label/' + postLabel + '?&max-results=' + perPage + '">' + firstText + '</a></span>'
          }
      }

      if (currentPageNo > 2) {
          if (currentPageNo == 3) {
              if (currentPage == "page") {
                  html += '<span class="showpage"><a href="' + home_page + '">' + prevText + '</a></span>'
              } else {
                  html += '<span class="displaypageNum"><a href="/search/label/' + postLabel + '?&max-results=' + perPage + '">' + prevText + '</a></span>'
              }
          } else {
              if (currentPage == "page") {
                  html += '<span class="displaypageNum"><a href="#" onclick="redirectpage(' + prevNumber + ');return false">' + prevText + '</a></span>'
              } else {
                  html += '<span class="displaypageNum"><a href="#" onclick="redirectlabel(' + prevNumber + ');return false">' + prevText + '</a></span>'
              }
          }
      }
      if (pageStart > 1) {
          if (currentPage == "page") {
              html += '<span class="displaypageNum"><a href="' + home_page + '">1</a></span>'
          } else {
              html += '<span class="displaypageNum"><a href="/search/label/' + postLabel + '?&max-results=' + perPage + '">1</a></span>'
          }
      }
      if (pageStart > 2) {
          html += ' ... '
      }
      for (var jj = pageStart; jj <= pageEnd; jj++) {
          if (currentPageNo == jj) {
              html += '<span class="pagecurrent">' + jj + '</span>'
          } else if (jj == 1) {
              if (currentPage == "page") {
                  html += '<span class="displaypageNum"><a href="' + home_page + '">1</a></span>'
              } else {
                  html += '<span class="displaypageNum"><a href="/search/label/' + postLabel + '?&max-results=' + perPage + '">1</a></span>'
              }
          } else {
              if (currentPage == "page") {
                  html += '<span class="displaypageNum"><a href="#" onclick="redirectpage(' + jj + ');return false">' + jj + '</a></span>'
              } else {
                  html += '<span class="displaypageNum"><a href="#" onclick="redirectlabel(' + jj + ');return false">' + jj + '</a></span>'
              }
          }
      }
      if (pageEnd < lastPageNo - 1) {
          html += '...'
      }
      if (pageEnd < lastPageNo) {
          if (currentPage == "page") {
              html += '<span class="displaypageNum"><a href="#" onclick="redirectpage(' + lastPageNo + ');return false">' + lastPageNo + '</a></span>'
          } else {
              html += '<span class="displaypageNum"><a href="#" onclick="redirectlabel(' + lastPageNo + ');return false">' + lastPageNo + '</a></span>'
          }
      }

      var nextnumber = parseInt(currentPageNo) + 1;
      if (currentPageNo < (lastPageNo - 1)) {
          if (currentPage == "page") {
              html += '<span class="displaypageNum"><a href="#" onclick="redirectpage(' + nextnumber + ');return false">' + nextText + '</a></span>'
          } else {
              html += '<span class="displaypageNum"><a href="#" onclick="redirectlabel(' + nextnumber + ');return false">' + nextText + '</a></span>'
          }
      }

      if (currentPageNo < lastPageNo) {
          //Iccsi was here, doing magic
          if (currentPage == "page") {
              html += '<span class="displaypageNum lastpage"><a href="#" onclick="redirectpage(' + lastPageNo + ');return false">' + lastText + '</a></span>'
          } else {
              html += '<span class="displaypageNum lastpage"><a href="#" onclick="redirectlabel(' + lastPageNo + ');return false">' + lastText + '</a></span>'
          }
      }

      var pageArea = document.getElementsByName("pageArea");
      var blogPager = document.getElementById("blog-pager");
      for (var p = 0; p < pageArea.length; p++) {
          pageArea[p].innerHTML = html
      }
      if (pageArea && pageArea.length > 0) {
          html = ''
      }
      if (blogPager) {
          blogPager.innerHTML = html
      }
  }

  function totalcountdata(root) {
      var feed = root.feed;
      var totaldata = parseInt(feed.openSearch$totalResults.$t, 10);
      looppagecurrentg(totaldata)
  }

  function pagecurrentg() {
      var thisUrl = urlactivepage;
      if (thisUrl.indexOf("/search/label/") != -1) {
          if (thisUrl.indexOf("?updated-max") != -1) {
              postLabel = thisUrl.substring(thisUrl.indexOf("/search/label/") + 14, thisUrl.indexOf("?updated-max"))
          } else {
              postLabel = thisUrl.substring(thisUrl.indexOf("/search/label/") + 14, thisUrl.indexOf("?&max"))
          }
      }
      if (thisUrl.indexOf("?q=") == -1 && thisUrl.indexOf(".html") == -1) {
          if (thisUrl.indexOf("/search/label/") == -1) {
              currentPage = "page";
              if (urlactivepage.indexOf("#PageNo=") != -1) {
                  currentPageNo = urlactivepage.substring(urlactivepage.indexOf("#PageNo=") + 8, urlactivepage.length)
              } else {
                  currentPageNo = 1
              }
              document.write("<script src=\"" + home_page + "feeds/posts/summary?max-results=1&alt=json-in-script&callback=totalcountdata\"><\/script>")
          } else {
              currentPage = "label";
              if (thisUrl.indexOf("&max-results=") == -1) {
                  perPage = 20
              }
              if (urlactivepage.indexOf("#PageNo=") != -1) {
                  currentPageNo = urlactivepage.substring(urlactivepage.indexOf("#PageNo=") + 8, urlactivepage.length)
              } else {
                  currentPageNo = 1
              }
              document.write('<script src="' + home_page + 'feeds/posts/summary/-/' + postLabel + '?alt=json-in-script&callback=totalcountdata&max-results=1" ><\/script>')
          }
      }
  }

  function redirectpage(numberpage) {
      jsonstart = (numberpage - 1) * perPage;
      noPage = numberpage;
      var nameBody = document.getElementsByTagName('head')[0];
      var newInclude = document.createElement('script');
      newInclude.type = 'text/javascript';
      newInclude.setAttribute("src", home_page + "feeds/posts/summary?start-index=" + jsonstart + "&max-results=1&alt=json-in-script&callback=finddatepost");
      nameBody.appendChild(newInclude)
  }

  function redirectlabel(numberpage) {
      jsonstart = (numberpage - 1) * perPage;
      noPage = numberpage;
      var nameBody = document.getElementsByTagName('head')[0];
      var newInclude = document.createElement('script');
      newInclude.type = 'text/javascript';
      newInclude.setAttribute("src", home_page + "feeds/posts/summary/-/" + postLabel + "?start-index=" + jsonstart + "&max-results=1&alt=json-in-script&callback=finddatepost");
      nameBody.appendChild(newInclude)
  }

  function finddatepost(root) {
          post = root.feed.entry[0];
          var timestamp1 = post.published.$t.substring(0, 19) + post.published.$t.substring(23, 29);
          var timestamp = encodeURIComponent(timestamp1);
          if (currentPage == "page") {
              var pAddress = "/search?updated-max=" + timestamp + "&max-results=" + perPage + "#PageNo=" + noPage
          } else {
              var pAddress = "/search/label/" + postLabel + "?updated-max=" + timestamp + "&max-results=" + perPage + "#PageNo=" + noPage
          }
          location.href = pAddress
      }
      /*]]>*/
</script>
</b:if>


Note: 
Adjust the value by setting the number of posts per page on your blog. The value is used to make how many number buttons you want to display. 4. Change all Url menus in the template that display post labels to be as follows. Example:var perPagevar numPages


  1. /search/label/NAMA-LABEL?&amp;max-results=7



  1. <a href='/search/label/Info?&amp;max-results=7'>Info</a>

  2.  

  3. <a href='/search/label/Tutorial%20Blogger?&amp;max-results=7'>Tutorial Blogger</a>




To create a label menu in the page widget (PageList) use the following code format. Example: 5. Look for all the codes as below in the Blog1 widget Delete or change to the following 6. If there is a Label widget in your blog. Look for the code like the following Delete and replace it with the code below. There are 2 similar codes, the first code for List display and the second code for Cloud display. If confused just change everything. 7. Save Themes / Templates. Note: If you change the value (number) on , then also adjust the value on all label Urls.
  1. /search/label/NAMA-LABEL?&max-results=7


  1. /search/label/English%20Article?&max-results=7



  1. <a expr:href='data:label.url' rel='tag'>


  1. <a expr:href='data:label.url + &quot;?&amp;max-results=7&quot;'rel='tag'>



  1. <a expr:dir='data:blog.languageDirection'expr:href='data:label.url'>


  1. <a expr:dir='data:blog.languageDirection'expr:href='data:label.url + &quot;?&amp;max-results=7&quot;'>






var perPagemax-results

No comments:

Post a Comment

Post Top Ad

Your Ad Spot