3

Label widget is essential in every blog it is one way of categorizing all of your content but as your blog posted a lot of blogger posts eventually labels will also expand, and you may need to control how many label should you will show, because if not your sidebar will be occupied by your expanding amount of label tags. There is a way to promote your label without sacrificing a lot of spaces from your sidebar.. I am going to teach you on how to make a dropdown menu for label tags.


Before applying this hack, you must already have

a Labels widget installed. If you don’t have one, go to Layout (old UI: Design > Page Elements) and add it.

Now let’s make the dropdown:
Go to Template > Edit HTML > Proceed (old UI: Dashboard > Design > Edit HTML).
Back up your template.
Make sure you DO NOT check the Expand Widget Templates checkbox.
Look for the following lines in your HTML code:
Replace that line with this 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'> 
<select style='width:100%' onchange='location=this.options[this.selectedIndex].value;'> 
<option>Click to choose a label</option> 
<b:loop values='data:labels' var='label'> 
<option expr:value='data:label.url'><data:label.name/> 
undefined<data:label.count/>) 
</option> 
</b:loop> 
</select> 
<b:include name='quickedit'/> 
</div> 
</b:includable> 
</b:widget>

Costumization:
  • Change the width of the dropdown menu bay changing 100% to any percentage, or pixel (px).
  • You can change “Click to choose a label” phrase in line 8 to your preferred phrase.
  • Code line 11 is for post count, if you do not want to show post count at the end of each label, delete this line.
Preview before saving.
Congratulations you have shrunk your labels widget and created more space.

Leave a Comment


Post a Comment

  1. It worked perfectly on my blogger blog.... Thanks for the great post

    ReplyDelete
  2. Thanks for the tutorial - very easy to follow and worked well.

    ReplyDelete
  3. how to fix no. of post in this post...

    ReplyDelete