Two weeks ago I published one of my best Blogger tweaks yet, how to hide certain posts from Blogger homepage. You get to hide certain posts simply by labeling the post 'hide'. One of the ways to view the hidden posts is by clicking on the 'hide' label, or any other name that you've chosen to trigger the hide sequence. Blog reader 'Gardens Jewish Experience' wants this particular label to be taken off from the Labels gadget as well.
In this tutorial, you will learn how to remove a particular label from the Labels gadget. It is completely independent from last week's tutorial. Therefore, you can always use this tweak to hide certain labels from appearing on your Labels gadget.
Step 1:
It goes without saying that you have to have the Labels gadget already added before attempting this tweak. If you don't know how to add the Labels gadget, this tutorial probably isn't for you. Next, access your template's HTML.
In default layout: Go to Dashboard - Design - Edit HTML - Expand Widget Templates.
In new layout: Go to Dashboard - Template - Edit Template HTML - Expand Widget Templates.
Find and delete the following lines then.
The lines to be deleted (Ending portion):
It goes without saying that you have to have the Labels gadget already added before attempting this tweak. If you don't know how to add the Labels gadget, this tutorial probably isn't for you. Next, access your template's HTML.
In default layout: Go to Dashboard - Design - Edit HTML - Expand Widget Templates.
In new layout: Go to Dashboard - Template - Edit Template HTML - Expand Widget Templates.
Find and delete the following lines then.
<b:if cond='data:display == "list"'> <ul> <b:loop values='data:labels' var='label'> <li> <b:if cond='data:blog.url == data:label.url'> <span expr:dir='data:blog.languageDirection'><data:label.name/></span> <b:else/> <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a> </b:if> <b:if cond='data:showFreqNumbers'> <span dir='ltr'>(<data:label.count/>)</span> </b:if> </li> </b:loop> </ul> <b:else/> <b:loop values='data:labels' var='label'> <span expr:class='"label-size label-size-" + data:label.cssSize'> <b:if cond='data:blog.url == data:label.url'> <span expr:dir='data:blog.languageDirection'><data:label.name/></span> <b:else/> <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a> </b:if> <b:if cond='data:showFreqNumbers'> <span class='label-count' dir='ltr'>(<data:label.count/>)</span> </b:if> </span> </b:loop> </b:if>The lines to be deleted (Starting portion):
The lines to be deleted (Ending portion):
Step 2:
Paste the following lines in place of the deleted lines above:
New lines in place (Ending portion):
That is it. I've included two entry-hiding lines above. That means you can hide up to two labels with the code above. If you want to hide more entries, simply duplicate the lines I've highlighted above. Note: For each label, you need to add two conditional tags (example: Line 4 and 22). And make sure you close both of them (Line 16 and 34).
Paste the following lines in place of the deleted lines above:
<b:if cond='data:display == "list"'> <ul> <b:loop values='data:labels' var='label'> <b:if cond='data:label.name != "hide"'> <b:if cond='data:label.name != "ADDITIONALLABEL"'> <li> <b:if cond='data:blog.url == data:label.url'> <span expr:dir='data:blog.languageDirection'><data:label.name/></span> <b:else/> <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a> </b:if> <b:if cond='data:showFreqNumbers'> <span dir='ltr'>(<data:label.count/>)</span> </b:if> </li> </b:if> </b:if> </b:loop> </ul> <b:else/> <b:loop values='data:labels' var='label'> <b:if cond='data:label.name != "hide"'> <b:if cond='data:label.name != "ADDITIONALLABEL"'> <span expr:class='"label-size label-size-" + data:label.cssSize'> <b:if cond='data:blog.url == data:label.url'> <span expr:dir='data:blog.languageDirection'><data:label.name/></span> <b:else/> <a expr:dir='data:blog.languageDirection' expr:href='data:label.url'><data:label.name/></a> </b:if> <b:if cond='data:showFreqNumbers'> <span class='label-count' dir='ltr'>(<data:label.count/>)</span> </b:if> </span> </b:if> </b:if> </b:loop> </b:if>New lines in place (Starting portion):
New lines in place (Ending portion):
That is it. I've included two entry-hiding lines above. That means you can hide up to two labels with the code above. If you want to hide more entries, simply duplicate the lines I've highlighted above. Note: For each label, you need to add two conditional tags (example: Line 4 and 22). And make sure you close both of them (Line 16 and 34).
Another thing. I've been extremely busy for the past few weeks, and I expect to be very busy for the next few weeks as well. I'll be moving to a new house, and I'm not gonna have access to the Internet for a few days. My only hope is to use tethering from my Android device to stay in touch with the cyberspace. After that I'll be attending the Google Top Contributors summit, so I'm not sure if I'll be able to respond to your questions in time. My apologies if it take ages for me to get back to your questions and comments. Cheers and God bless.
Awesome work! Have been looking for this for awhile.
ReplyDeleteJust wondering if there's any way for this hide technique to be available in the pagination function as well? My site is hiding the posts well but the pagination at the bottom is still running, so it shows a certain number of pages which are empty.
Any advice?
Hi Syn,
DeleteAuto-pagination has been a frenemy. It is useful, but at cases like yours, we can't really turn it off, unfortunately.
not work in my blog
ReplyDeleteI can not find
What template do you use?
DeleteMy template doesn't have data:labels, so i'm trying to figure out where I should put the start of the conditionals.
ReplyDeleteseems can't post code on comments.
Hi Jimmy,
DeleteAre you using a third party template? I'm afraid the tweak above is made for Blogger' default templates.