How to Show and Hide Blogger Widgets? |
Conditional tags are very important for sorting and controlling Blogger widgets. Blogger Widgets can be customized by customizing these small Conditional tags.
How to do?
- Login to your blog first.
- Then click on Template> Edit Html.
How to Show and Hide Blogger Widgets? |
- Then press Ctrl + F from the keyboard to find each Html tag. Expand the codes and you will see exactly as below.
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' 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>
</b:widget>
- In the widget above, I am showing the “latest tune” widget of my blog as an example. This widget of my blog will not show on the home page, but you can see it on any tune page
Code tag contact:
- 'Item' here means only the tune page.
- Here 'Index' means Homepage and Search / Label Pages.
01. Widgets to show on Homepages only:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' 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>
</b:widget>
02. To hide from Widgets Homepages:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' 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>
</b:widget>
03. Widgets to show only in Static Pages:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType = "static_page"'>
<!- 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>
</b:widget>
04. To hide from Widgets Static Pages:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType!= "static_page"'>
<!- 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>
</b:widget>
05. Widgets to show only on certain pages:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url = "URL of Selected Post"'>
<!- 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>
</b:widget>
06. Widgets only to hide from certain pages
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url!= "URL of Selected Post"'>
<!- 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>
</b:widget>
07. Widgets to show only on the first page of home pages
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:post.isFirstPost'>
<!- 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>
</b:widget>
07. Widgets to show on Index Pages only:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType = "index"'>
<!- 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>
</b:widget>
09. To hide from Widgets Index Pages:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType!= "index"'>
<!- 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>
</b:widget>
10. Widgets to show on Search Pages only
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.searchLabel'>
<!- 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>
</b:widget>
11. Widgets to show in Mobile Browsers only:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.isMobileRequest = "true"'>
<!- 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>
</b:widget>
12. Widgets to show in Computer Browsers only:
<b: widget id = 'HTML4' locked = 'false' title = 'Last Tune' type = 'HTML'>
<b:includable id='main'>
<b:if cond='data:blog.isMobileRequest = "false"'>
<!- 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>
</b:widget>
- After adding each new Conditional Statement, you must save the Blogger Template.
إرسال تعليق