I have already written " How to show only specific number of posts on Labels Page ". Today I am going to tell How to Show Only Labels with specific number of posts. This hack is very useful for those who have plenty of Labels in their Blog. It's a very simple hack , just follow the below steps to implement this hack in your blog.
Step 1 : Login to your Blogger Account and go to Layout section of your Blog.
If you don't have any Labels widget then add it by clicking ADD Page ELEMENT link in the Page. Then navigate to EDIT HTML subtab and Check EXPAND WIDGETS box.
Step 2 :
Now search for this Line.
<b:widget id='Label1' locked='false' title='Labels' type='Label'>
Now below this line , you will find this code
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<data:label.name/>
<b:else/>
<a expr:href='data:label.url'><data:label.name/></a>
</b:if>
(<data:label.count/>)
</li>
</b:loop>
Now replace the above code with the following code.
var labelnum = 0;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> > 2) {
document.write("<li><a expr:href='data:label.url + "?max-results=5"'
rel='nofollow'><span><data:label.name/></span></a>(<data:label.count/>)</li>");
}
</b:loop>
</script>
It should look like this
In the above script edit the text in green to show Labels which contains more than text in Green.
for example : I have chosen number 2 , then Labels which contains more than 2 posts will be shown and other labels will be hidden.
Edit the text in red to show only specific number of posts in Labels Page.
That's it , you have successfully implemented the "Show Labels with specific number of Posts " hack in your blog.
If you have any problem , let me know.
<script type='text/javascript'>
on August 25, 2008 at 9:38 AM
This is not work for me!
This is my code for Labels ---> http://code.google.com/p/labelsssss/
Please mail me if u know what to do to fix for me. My email is here-mishef@gmail.com
Thanks a lot.
on August 25, 2008 at 10:55 AM
wow rias,
Today, I requested for this....and you posted same thing.. you are great.. I will see this hack and will respond you...
thanks...
I also mailed you my template, please do that was i requested
on August 31, 2008 at 12:04 PM
Hey ur posts are so cool and code display is very awesome!
Thank you :)
on September 1, 2008 at 8:43 AM
Thanks a lot, though I would prefer to being able to filter out some labels in the sidebar (as they are already in the menubar) this is a relatively good workaround. Or should I say: best one found so far :) Thanks again Mohamed.
on November 12, 2008 at 1:32 PM
Thanks a lot
on December 17, 2008 at 4:55 PM
Nice layout! Good info! I subscribed.
on January 10, 2009 at 2:28 PM
0 for 2 on your reco's ... Get this error
bX-4h0tgg
on January 23, 2009 at 1:25 AM
not working
on February 9, 2009 at 5:49 AM
Gr8 share thanx
on May 15, 2009 at 2:27 AM
Thanks, works good. Is it possible to show specific number of posts on achieve pages?
on May 21, 2009 at 3:13 PM
Not working for me!
Post a Comment