Tuesday, December 30, 2014

Reverse Post order with Date : Blogging


Today i am sharing a nice blogging tricks for Blogger Blogspot, Many blogger looks for the way to how to make reverse order of Post with date, means that New Post will show in reverse order and old post show on Top. There is a way of doing this by selecting date of the post from schedule, but this trick not work for those who don't have sufficient time to do this. Remembering date and time of the Post is also a thing of matter, some people can't do this and find themselves helpless.

Reverse Post order with Date : Blogging

Reverse Post Orders with Date: Blogging


This post is for those people who want to save their time for making oldest post on top.

Here is the way of doing this......

1.  Go to Template.

2. Then click Edit HTML.

3. Search for the </body> Tag.

4.  Just Above the </body> Tag,  Past the following code.

Note: This code been taken from the link Techsquirrel's

<!-- Start Post Reversal Code --><script type='text/javascript'>  function ReversePosts(BlogPostContainer,PostClass) {
 
    var found=false;

    var BlogPosts = BlogPostContainer.childNodes;
    var i=0;    var j=BlogPosts.length-1;

    for( ; ; ) {  
      while( (i < j) && (!(cn=BlogPosts[i].className) || !(cn.match(PostClass))) )        ++i;


      while( (i < j) && (!(cn=BlogPosts[j].className) || !(found=cn.match(PostClass))) ) // (see Footnote 1)        --j;
      if( found && i < j ) {        // Swap Posts (see Footnote 2)        var tempi = BlogPosts[i].cloneNode(true);        
        var tempj = BlogPosts[j].cloneNode(true);        
        BlogPostContainer.replaceChild(tempi,BlogPosts[j]);        BlogPostContainer.replaceChild(tempj,BlogPosts[i]);      } else {

        break;    
      }

      ++i; --j;    }  }
  var BlogWidget             = 'Blog1';  var BlogPostContainerClass = 'blog-posts';  var BlogPostClass          = 'date-outer';  var DatePostContainerClass = 'date-posts';  var DatePostClass          = 'post-outer';
  var Blog1 = document.getElementById(BlogWidget);

  var BlogPostContainer;  var x=0;  do {    BlogPostContainer = Blog1.childNodes[x++];  } while ( !(cn=BlogPostContainer.className) || !(cn.match(BlogPostContainerClass)) );
   ReversePosts(BlogPostContainer,BlogPostClass);

  var BlogPosts = BlogPostContainer.childNodes;  for ( i = 0; i < BlogPosts.length; ++i ) {

    if ( (cn=BlogPosts[i].className) && cn.match(BlogPostClass) ) {      var DatePostContainer;      x=0;

      do {        DatePostContainer = BlogPosts[i].childNodes[x++];      } while ( !(cn=DatePostContainer.className) || !(cn.match(DatePostContainerClass)) );
      ReversePosts(DatePostContainer,DatePostClass);    }  }//]]></script><!-- End Post Reversal Code -->
After doing this you can see the old Date Post at top and latest Post at the end, for some cases this code is very useful to show the page order in case of tutorials websites and institution related Website. In wordpress you can do it easily while in Blogger blogging it is hard to do, so this code helps you alot.

Thanks

If you like the Post Kindly share this to your friends for the sake of knowledge, because sharing is Crazy...........

0 comments:

Post a Comment