
We will be using different conditional tag to selectively display widget on any preferred pages.
How To Show Widget Only On Homepage
Use the following conditional tag to show widget on homepage only.
<b:if cond='data:blog.url == data:blog.homepageUrl'>
WIDGET CODE HERE
</b:if>
How To Hide Widget On Homepage
<b:if cond='data:blog.pageType == "item"'>
WIDGET CODE HERE
</b:if>
How To Show Widget Only On Static Pages
<b:if cond='data:blog.pageType == "static_page"'>
WIDGET CODE HERE
</b:if>
How To Hide Widget On Static Pages
<b:if cond='data:blog.pageType != "static_page"'>
WIDGET CODE HERE
</b:if>
How To Show Widget Only On Archive Pages
<b:if cond='data:blog.pageType == "archive"'>
WIDGET CODE HERE
</b:if>
How To Hide Widget On Archive Pages
<b:if cond='data:blog.pageType != "archive"'>
WIDGET CODE HERE
</b:if>
How To Show Widget On A Selected Post
<b:if cond='data:blog.url == "URL Of Selected Post"'>
WIDGET CODE HERE
</b:if>
How To Hide Widget On A Selected Post
<b:if cond='data:blog.url != "URL Of Selected Post"'>
WIDGET CODE HERE
</b:if>
How To Wrap Widget With The Conditional Tag
The conditional tag can be applied to any widget using the same procedure.
- Go to your blogger dashboard
- Click on Template > Edit HTML > Proceed (Mark/Tick Expand Widget Template)
<b:widget id='Widget-ID' locked='' title='Widget-Title' type=''>
<b:includable id='main'>
LARGE CODE
</b:includable>
</b:widget>
<b:includable id='main'>
LARGE CODE
</b:includable>
</b:widget>
Wrapping the widget with any conditional tag, the final result will look like the following:
<b:widget id='Widget-ID' locked='' title='Widget-Title' type=''>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
LARGE CODE
</b:if>
</b:includable>
</b:widget>
<b:includable id='main'>
<b:if cond='data:blog.url == data:blog.homepageUrl'>
LARGE CODE
</b:if>
</b:includable>
</b:widget>
The conditional tag used above is just an example, you can choose any condition tag of your choice, and the same procedure applies to all.
Any queries or contribution/appreciation is highly welcome, and don't forget to share it with friends/followers.
0 comments:
Post a Comment