Regain control of your sidebar, shrink the widget -by converting it into a dropdown (or is it a pulldown?) menu. Your labels widget size will be reduced to just one line! And only expand into a full list when you click it.
Before applying this hack, you must already have a Label widget installed. If you don’t have one, go to Design > Page Elements and add it.
Now let’s make the dropdown:
- Go to Dashboard > Design > Edit HTML.
- Back up your template.
- Make sure you DO NOT tick the Expand Widget Templates checkbox.
- Look for the following lines in your HTML code:
1
<
b:widget
id
=
'Label1'
locked
=
'false'
title
=
'Labels'
type
=
'Label'
/>
- Replace that line with this code:
01
<
b:widget
id
=
'Label1'
locked
=
'false'
title
=
'Labels'
type
=
'Label'
>
02
<
b:includable
id
=
'main'
>
03
<
b:if
cond
=
'data:title'
>
04
<
h2
><
data:title
/></
h2
>
05
</
b:if
>
06
<
div
class
=
'widget-content'
>
07
<
select
style
=
'width:100%'
onchange
=
'location=this.options[this.selectedIndex].value;'
>
08
<
option
>Click to choose a label</
option
>
09
<
b:loop
values
=
'data:labels'
var
=
'label'
>
10
<
option
expr:value
=
'data:label.url'
><
data:label.name
/>
11
(<
data:label.count
/>)
12
</
option
>
13
</
b:loop
>
14
</
select
>
15
<
b:include
name
=
'quickedit'
/>
16
</
div
>
17
</
b:includable
>
18
</
b:widget
>
- 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. You can now add more widgets! Oh no, you don’t! :)
- Enjoy!
No comments:
Post a Comment