Adding Recent Comments & Posts Widgets For Blog - Life Digital
feedburner
Enter your email address:

Delivered by FeedBurner

Add to Google Reader or HomepageAdd to netvibesAdd to My AOLSubscribe in NewsGator Online

Adding Recent Comments & Posts Widgets For Blog

Labels: , , ,

I have just read Amanda's new way to add recent comments to Blogger layout and wanted share a different Recent Comments hack that lets you show more than 5 comments and much more easier .



Advantages of This Way
  1. It will not slow down your blog's load time.

  2. You can add both Recent posts and Recent comments with this way

  3. You can show more than 5 posts or comments with this hack.

  4. Its easy to apply codes to your template.



Adding Page Elements




Go to your  layout and click Add a Gadget , and then chose HTML / JAVASCRIPT , now type Recent Comments ( or Posts) to title and type same thing (Recent Comments ( or Posts) ) to content and save.



Adding Codes To Template



Now , go to your layout and then click Edit HTML and now check Expand Widget Templates, now find the following code :

</head>


and click here and on the page copy all codes using CTRL+A and then CTRL+C combination and paste the codes before  </head> tag.




You can set the number of posts/comments will be shown on your blog , changing the digit in orange.



var numposts = 10;  
If you did everything i told you to add this widget , now search for the title you typed for the gadget (Recent Comments ( or Posts) ) we added  and delete the lines shown in orange.



<b:widget id='HTML1' locked='false' title='Recent Comments' type='HTML'>


<b:includable id='main'>

  <!-- only display title if it's non-empty -->

  <b:if cond='data:title != &quot;&quot;'>

    <h2 class='title'><data:title/></h2>

  </b:if>


  <div class='widget-content'>

    <data:content/> >> Delete these lines

  </div>

  <b:include name='quickedit'/>

</b:includable>


</b:widget>




And now add the codes below to the place we deleted the lines , if you can the line in orange to "posts" it will show your recent posts in widget .



 <!-- recent articles code start -->

&lt;script src=&quot;/feeds/comments/default?orderby=published&amp;amp;alt=json-in-script&amp;amp;callback=rp&quot;&gt;&lt;/script&gt;


<!-- recent articles code end -->


And save. You cannot preview the widget without saving , so clicking preview will not show you the widget.



Thats all!

Furl Ma.gnolia Blinkbits Meneame Simpy Yahoo DiggIt! Del.icio.us Fresqui Reddit Blinklist Netvouz Technorati


0 comments:

Post a Comment