Monday 20 January 2014

HOW TO: CREATE AND CUSTOMIZE A DROP DOWN LABEL WIDGET!

Hello,
Recently I've been... attempting... to spice up my blog design and add in some new features and one of my new features is a drop down label menu. Let me show you how to do it!

Note: This only works in Blogger.

Step One: Firstly add in the labels widget into your blog. Start by logging into your account and then go to your dashboard, select your blog, go to the 'Layout' section which is in the left sidebar and then click on 'Add A Gadget' and the 'Labels' gadget wherever you want it to be, I want it to be in my sidebar so I am adding it there!

This was a different type of post in which I am normally used to posting, if you like these sorts of helpful, how-to posts let me know so I can create more!

Step Two: Look at the left sidebar and find 'Template' which should be directly underneath the 'Layout' tab. Click on 'Edit HTML'. Now click anywhere inside your template editor where all the HTML codes are and then press Ctrl + F if you are using a Windows computer, if you are using a Mac then do Command + F, search for Label1 in your template. You will now see a line of code which should look like the code below in bold.

<b:widget id='Label1' locked='false' title= 'Labels' type= 'Label'/>

Step Three: Replace that code with the code below in bold.

<b:widget id='Label1' locked='false' title='Search With The Label...' 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>Pick A Label</option>
<b:loop values= 'data:labels' var='label'>
<option expr:value= '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>

Customization


If you'd like you could easily customize your drop down label widget!

  • You could replace the RED colour 'Search With The Label...' with your desired title for the drop down menu.
  • You could change the width of the the drop down menu by changing the PURPLE colour that says 'width:100%' with whatever percentage you want the width to be.
  • You could change the title of the drop down menu which is in the colour GREEN which says 'Pick A Label' with the title of the drop down menu instead.
  • If you do not want to display the number of posts go under the label category you can remove (<data:label.count/>) which is in ORANGE.
So my final code for me is going to be:

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

I hoped this helped any of you! If you enjoy reading these posts, let me know so I can post more of these helpful 'how to's'!
post signature

5 comments :

  1. Hi Lauren!
    I've nominated you for The Liebster Award!
    Feel free to to check out my blog for more information at www.thethoughtsofateen.com

    ReplyDelete
  2. Your blog looks so nice and this was really helpful thanks;)

    www.daisieblogs.blogspot.co.uk

    ReplyDelete
  3. Hey I have changed my blog button so could you change my button on your blog as we did a button swap. Thanks

    http://thenextchapter14.blogspot.co.uk/

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...