We have been moved to http://www.bloganol.com/

You may have used maximum labels at your blog posts . showing all the labels at label widget may make your label widget look dirty . There is a solution or a hack to show limited labels at label widget by betabloggerfordummies. By using this hack you can show labels having more posts as you define . For example if you define "5" then the labels having more than 5 posts will be displayed.

Hack starts:

Step 1

First of all sign in to your blogger Account after that goto Layout Page.Now add label widget in your blog (Add a Page Element --> Labels --> Save).If you already have label widget in your blog then you should not have to do this step.

Step 2

Goto Edit HTML section , Expand Widget Templates and Search for the following Code.

<b:widget id='Label1' 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/>
</a>
</b:if>
<span dir='ltr'>(<data:label.count/>)</span>
</li>
</b:loop>
</ul>

<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
Step 3

Replace the above code with the following code.

<b:widget id='Label1' locked='false' title='Labels' type='Label'>
<b:includable id='main'>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<ul>
<script type='text/javascript'>
var labelnum = 0;
<b:loop values='data:labels' var='label'>
if (<data:label.count/> &gt; 2) {
document.write(&quot;<li><a expr:href='data:label.url + "?max-results=100"'
rel='nofollow'><span><data:label.name/></span></a>(<data:label.count/>)</li>&quot;);
}
</b:loop>
</script>
</ul>
<b:include name='quickedit'/>
</b:includable>
</b:widget>

The code above will only show labels with more than two posts. To increase number of labels increase the number two in this code :
if (<data:label.count/> &gt; 2) {

comments

1 Responses to "Show top labels or labels having more posts at label widget"
Ijas M said...
August 8, 2009 at 10:13 PM

Thanx
its working good


Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!