How To Change the Amount of Post When Click on Label

Posted by Lasantha Bandara on May 19th, 2009 File Under : change template, html, widget1 Comment

You can change maximum number of Posts When Click on Label.

For example if you want to set maximum number of posts to 20 ,follow the steps below to do it.

1.Log in to your dashboard--> layout- -> Edit HTML

2.Click on "Expand Widget Templates"

3.Scroll down to where you see this:

<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url' rel='tag'> <data:label.name/> </a> <b:if cond='data:label.isLast != "true"'> , </b:if>
</b:loop>

4.Now Replace above code with below code.

<b:loop values='data:post.labels' var='label'>
<a expr:href='data:label.url + "?max-results=20"' rel='tag'> <data:label.name/> </a> <b:if cond='data:label.isLast != "true"'> , </b:if>
</b:loop>

NOTE :

If you do not use  Label Widget save your template and you are done.But if you use Label Widget continue with next steps.

5.Now you must find the  place of Label Widget code.Find the code below.

<b:widget id='Label99' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
  <b:if cond='data:title'>
  <h2><data:title/></h2>
  </b:if>
  <div class='widget-content'>
  <ul>
  <b:loop values='data:labels' var='label'>
  <li>
  <b:if cond='data:blog.url == data:label.url'>
  <span expr:dir='data:blog.languageDirection'>
  <data:label.name/>
  </span>
  <b:else/>
  <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'>
  <data:label.name/>

6.Now Replace above code with below code.

<b:widget id='Label99' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
  <b:if cond='data:title'>
  <h2><data:title/></h2>
  </b:if>
  <div class='widget-content'>
  <ul>
  <b:loop values='data:labels' var='label'>
  <li>
  <b:if cond='data:blog.url == data:label.url'>
  <span expr:dir='data:blog.languageDirection'>
  <data:label.name/>
  </span>
  <b:else/>
  <a expr:dir='data:blog.languageDirection' expr:href='data:label.url + "?max-results=20"'>
  <data:label.name/>

READ THIS !!!

In my case Label Widget ID is 99.In your template it will be a different value.so you must use your real Label Widget ID.

7.Now save your template and you are done.

File Under : change template, html, widget

One Response to “How To Change the Amount of Post When Click on Label”

  1. Admin says:

    Thanks This article is very useful !!! I am displaying only blogpost title when clicking on labis el but i did'nt get how to display blogtitles in very beautiful manner i.e using bullets or numbering
    plz reply me !!!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.