+/- (hide/show, expand/collapse) Labels
I'm on a label enhancement mission. Maybe my drop down menu label method didn't do it for you. Good news! Here is another option for you label makers using the infamous +/- method. This is simple, simple, simple.
Step 1 - Without expanding your widgets, find this code in your template:
<b:widget id='Label1' locked='false' title='Labels' type='Label'>Step 2 - Replace that line with this code:
<b:widget id='Label2' locked='false' title='Labels and Feeds' type='Label'>TaDa! Label those posts!
<b:includable id='main'>
<script type='text/javascript'>
//<![CDATA[
if(typeof(rnd) == 'undefined') var rnd = '';
rnd = Math.floor(Math.random()*1000);
rnd = 'id-' + rnd;
document.write('<a href="#" onclick="tmp = document.getElementById("' + rnd + '"); tmp.style.display = (tmp.style.display == "none") ? "block" : "none"; return false;" style="float:left;margin-right:5px;">');
//]]>
</script>[+/-]
<script type='text/javascript'>
//<![CDATA[
document.write('<\/a>');
//]]>
</script>
<b:if cond='data:title'>
<h2><data:title/></h2>
</b:if>
<div class='widget-content'>
<script type='text/javascript'>
//<![CDATA[
document.write('<div id="' + rnd + '" style="display:none;">');
//]]>
</script>
<ul>
<b:loop values='data:labels' var='label'>
<li>
<b:if cond='data:blog.url == data:label.url'>
<data:label.name/>
<b:else/>
<a expr:href='data:label.url'><data:label.name/></a>
</b:if>
</li>
</b:loop>
</ul>
<script type='text/javascript'>
//<![CDATA[
document.write('<\/div>');
//]]>
</script>
<b:include name='quickedit'/>
</div>
</b:includable>
</b:widget>
EDIT: 08/16/08 - In order for this to work, you have to have a label widget in place. And you have to have posts labeled. So, go to your dashboard | layout | page elements | add a gadget | Labels before trying this code.
36 Comments:
WoW, this feature is incredible, and I never knew that the blogspot can also has this kind of awesome modification...
Thanks for the great code, Annie and you simply the best ;)
Thanks for the code... I will use it for my other blog. By the way, the inline commenting does not work in my template. I followed your instructions to no avail.
@Petitehye, about the inline commenting. Did you open your dashboard through the blogger in draft link in the post? If you can't get it, send me your xml file and I will take a look.
wow, thankt you so very much!
really nice from you to share the code... I will use it on our comercial site. It´s hard to find this kind of great mods.
Excellent article
wow...wonderful article..thanks for sharing those..really amazed me a lot...keep posting.
Thanks for the code.
I read similar articles elsewhere, but this is the most detailed and fun to read! You seem to be putting so much time into your blog :) Thx for this post! I'll have you bookmarked.
Thanks a lot for posting this useful code! I was looking for this to use on my SizeGenetics reviews website.
Awesome! The code i was looking for everywhere! thanks a lot dude!
I have been looking for this everywhere!! Thanks for sharing, will let my friends know about this cool blog!
Hi. You have a great university here. Congratulations!
Is there a way to place the [+/-] symbol ni front of the widget name? My template does not go well with it's placement behind the title.
Thanks for all your work.
@Jose Oliveria, I played with it a bit and couldn't get the +/- to work behind the title.
:-(
I replaced exactly what you said and get only error message:
Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly.
XML error message: The element type "b:section" must be terminated by the matching end-tag "".
Well this solution would be my rescue for my band labels. http://metallschaedel.blogspot.com/
Any ideas why it does not work?
Thaks for your kind help
@Schwizer, If you send me hour XML file, I can take a look.
really nice from you to share the code... I will use it on our comercial site. It´s hard to find this kind of great mods.
I cannot find the code from Step 1 in my HTML template.
MMA Ratings
@Eric Kamander, do you have labels enabled presently and some posts labeled? Make sure you have some sort of label widget in your sidebar. Then it just becomes a matter of searching for "label" in your template until you find the code in step 1. It's there. (I just took a look at your blog, and there isn't a label widget. Go to dashboard/layout/page elements/add a gadget.)
i just stopped by to tell you that you are really great and your advices helped me sooo much!
you are doing a great job! keep up great work! tnx 4 every advice on your blog!
best regards!
Thanks for the coding tip. We are just working on a new blog and will definitely use some of your tips. Really helpful!!
Nice tips bro...
That's groovy. Water Damage
Very informative! I just love it ..... well i don't have any doubt about your articles... your posts are awesome... Honestly you are simply the best.Thanks for sharing this in your post with us. This a definitely a very good read for me!Keep posting
I opted to remove the labels all together. Thanks.
A great info. Thanks for sharing.
U have amazing and informative site! I' trying my luck n hade in attempting them...right now i have already changed my labels in +/- labels. It is working great n takes least time.
Can the label-link be open in the new window page, when clicked??
wow...nice tips, I looking for this...thanks
Hi Annie,
This is great and I am using it on my blog. I want to ask if there is any way to get the Label count back into the list when expanded.
Thanks!
~sms
Hello BlogU,
Thanks for this technical advise.
I'm using the blogger template TypoXP 2.1 but I didn't find this line:
It seems that he used an other CSS code. Just look his CSS code here where I download the template. Look here:
http://www.themes-online.com/2008/06/typoxp-21-blogger-new-template/
Thanks to consider my request. I will come back here to read you.
See you later !
MTS
This is a great help in saving space on my blog..I will definitely try this code...thanks a lot for sharing..I hope you won't grew tired sharing your ideas and knowledge to us!
This is great and I am using it on my blog.
keep up great writing.
not working for me
I followed the way you said but there was displaying some kind of error message.may be it could be i got something wrong, will try to do it again. hope this time will work it.
how about trying that on blog cloud? I think u would like to try that. would u not? i think it works. i will again write if it works with the colored blog label cloud. well its blog, everything is possible.
Really great this is working.
Best tutorial i find this from so many days finally i found that.