image



Like one of my other recent posts, this Blogger trick has been going around the web for quite some time now, especially among experienced bloggers. But since there are still quite a number people asking how this is done, I thought I’d feature it for today’s post.
One of the reasons why you’d want to hide a widget is to avoid cramming to much stuff on your page, which distracts your visitors; you only want the relevant and essential widgets to be visible depending on the content of the current page.
So how do you do this? Just follow these steps:
  1. On your Blogger dashboard, go to Design (‘Template’ for new interface) then ‘Edit HTML’
  2. Check the ‘Expand Widgets Template’ box
  3. Search for the title of the widget you want to show/hide (press Ctrl+F). The code will look something like this:
<b:widget id='HTML' locked='false' title='WIDGET-TITLE' type='Profile'>
<b:includable id='main'>
WIDGET CODE GOES HERE
 </b:includable> </b:widget>
Once you find it, you’ll also see a line of code that looks similar to the ones I highlighted in blue. All you have to do is wrap the widget’s code with the following code below (highlighted in green):
Show widget only on Homepage:
<b:widget id='HTML' locked='false' title='WIDGET-TITLE-HERE' type='Profile'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
WIDGET CODE GOES HERE
</b:if>
 </b:includable> </b:widget>
Hide widget on Homepage:
<b:if cond='data:blog.pageType == "item"'>
WIDGET CODE GOES HERE
 </b:if>
Show widget only on Static Pages:
<b:if cond='data:blog.pageType == "static_page"'>
WIDGET CODE GOES HERE
 </b:if>
Hide widget on Static Pages:
<b:if cond='data:blog.pageType != "static_page"'>
WIDGET CODE GOES HERE
 </b:if>
Show widget on Selected Post:
<b:if cond='data:blog.url == "URL OF Selected Post"'>
WIDGET CODE GOES HERE
 </b:if>
Hide widget on Selected Post:
<b:if cond='data:blog.url != "URL OF Selected Post"'>
WIDGET CODE GOES HERE
 </b:if>
Notice the pattern? Well, now you know how it’s done. Cheers!



0 comments:

Post a Comment

 
Top