Since we started the My e-Tricks we brought you various kinds of Computer Tips and Tricks, Facebook Tricks, Windows Tricks and more other tricks. Now we are going to give you Blogger Tricks.
As the internet users we know most people create blogs to share Knowledge, Fun, Information and etc... There are two famous free blogging sites named Wordpress and Blogger. So we will give you blogging tricks, widgets and many more things for bloggers.As a first post in blogger tricks, we give you a great and useful trick How to Show/Hide widgets on Blogger Homepage or Post pages.
First of all you have to Name a widget that can be easy find. If there is no name to your widget name it manually your self and after done this you can remove it. Now copy the name of the widget that you want to show/hide. We choose a widget named Comments.
Then go to Template > Edit HTML > Proceed > Expand widget template.
Now press Ctrl + F to open the Find box. Then paste your widget's name in the find box and search it. So you can see the code similar to this. Because normally any widget code like this. This is the basic code for a widget.
<b:widget id='HTML1' locked='false' title='Your Widget name' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
Now you have to modify your widget code little bit.<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:includable>
How to show a widget only on Hompage.
After the finding your widget code add following RED codes into the widget code like this.
<b:widget id='HTML1' locked='false' title='Your Widget name' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable>
Now click on Save Template button and view your blog. Now you can see your widget on Homepage and go to the another page like Post Page, Statics Page. If you're done it correctly you won't see modified widget on other pages except the Homepage.
How to hide widget from Homepage and show it only on Post Pages.
See our Comments Widget and Related Posts Widget. Those two widgets are showing in Post pages only. So find the widget that you want to show it only on post pages like above and add following RED codes to the widget code like this.
<b:widget id='HTML1' locked='false' title='Your Widget name' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "item"'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<div class='widget-content'>
<data:content/>
</div>
<b:include name='quickedit'/>
</b:if>
</b:includable>
Then Save your template and view your blog. Now it isn't showing on Homepage. It showing now only on Postpages.
thanks mate, ive already hide one of my widget on my homepage.
ReplyDelete