Display Blogger Labels In A Drop Down Menu In Blogger

A labels widget displays your post labels. Displaying labels with lists or cloud menu is good enough for new blogs or blog with few posts and labels. It will occupy a lot of space in blog's side bar. Using this hack, labels widget size will be reduced to just one line & will only expand into a full list when you click it.

DEMO



How To Create Dropdown Menu For Labels Widget

  • Go to Blogger Dashboard 
  • Click on DropDown Menu and select Template
  • Backup your Template before making any changes to your blog
  • Now Click on Edit HTML --> Proceed --> Expand Widget Templates
  • Press Ctrl + F and search the code shown below


<b:section class='sidebar' id='sidebar' preferred='yes'>


  • Now Paste the Code Shown Below just below/after it


<b:widget id='Label1' locked='false' title='Categories' 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 Category</option>
<b:loop values='data:labels' var='label'>
<option expr:value='data:label.url'><data:label.name/>
(<data:label.count/>)
</option>
</b:loop>
</select>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>

  • Now save your template

CUSTOMIZATION

  • If you want change the width of the drop down menu then change this value width:100% to any percentage, or pixel (px).
  • To change the phrase “Click To Choose a Category” then replace it with your preferred phrase.
  • If you do not want to show post count at the end of each label then delete this line (<data:label.count/>) .

Like it? Share it.

6 comments

16 May 2012 at 01:21

can we make more than one drop down menu for labels,,like placing some labels in one drop down menu and others in 2nd drop down menu and so on..

16 May 2012 at 01:55 Author

@Jobs On ChoiceYes you can make more than one

16 May 2012 at 06:50

How to create a scrolling twitter feed using jquery?

11 May 2013 at 17:20

thank you very nice post.arba oyunları

10 July 2013 at 05:05

how can I add this in a page?? not in a sidebar

10 July 2013 at 21:14

@Sherif Bugnah
Hi Sherif, if you want to add it in a page you need to manually add the labbel

follow this link

http://demo4.mybloggertools.org/2013/07/display-label-in-page.html

Click to Add a New Comment

  • If you're asking a question click on Subscribe By Email link, on the comment form, to be notified of replies.
  • Do NOT add links to the body of your comment as they will not be published.
  • Only the comments posted in ENGLISH will be approved.
  • If you have a problem check first the comments , maybe you will find the solution there.