Follow Me

Some Functional Tag Functions in Widgets

Some Functional Tag Functions in Widgets
Some Functional Tag Functions In Widgets - There are a number of tricks to hide blog elements either on the home page / homepage, post, or static page, that is by adding a conditional tag code in each element that you want to hide.

For the latest version of the conditional blogger tag, you can check here the Latest Blogger Conditional Tag

Application example:

<b:if cond='data:blog.pageType != "static_page"'>
..... Fill in the content that will be wrapped in conditional tags (Content will be hidden in static pages) .....
</b:if>

Not only does it hide an element but can also display certain elements on only one page that you specify.

Application example:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
..... Fill in the content that will be conditionally tagged (Content will only appear on the home page) .....
</b:if>

for more details, please see some conditional tag functions for the widget below:

1. Display the widget only on the home page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>

2. Display the widget only on the posting page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>


3. Displays the widget only on certain pages

<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url == "URL Anda"'>
<!-- 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>


Note: Change your URL with the address you want.

4. Hiding widgets only on certain pages

<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.url != " URL anda "'>
<!-- 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>


5. Display the widget on a static page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>


6. Hide the widget on a static page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>


7. Display the widget only in the archive page


<b:widget id='HTML1' locked='false' title='Recent Posts' type='HTML'>
<b:includable id='main'>
<b:if cond='data:blog.pageType == "archive"'>
<!-- 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>


8. Shows the widget only in the index page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>


9. Hide the widget on the index page

<b:widget id='HTML1' locked='false' title='Recent Posts' 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>


Application on certain content

This is a conditional tag that you want to add to certain conditions, such as HTML, CSS, Javascript, etc.

Conditional tags for certain labels

<b:if cond='data:blog.searchLabel'>
<div class='arlinadesign'>CONTENT HERE</div>
</b:if>

Example:

<b:if cond='data:blog.searchLabel == "NAMA LABEL"'>
<div class='arlinadesign'>CONTENT HERE</div>
</b:if>

Conditional tags for certain search pages

<b:if cond='data:blog.searchQuery'>
<div class='arlinadesign'>CONTENT HERE</div>
</b:if>


Example:

<b:if cond='data:blog.searchQuery == "NAMA LABEL"'>
<div class='arlinadesign'>CONTENT HERE</div>
</b:if>

After you add the conditional tag above, save the template and see the results.

Not limited to widgets, with conditional tags you can wrap other elements such as Scripts, CSS, and HTML in the template for the reason to speed up the blog by reducing the Script contained on a page or other privacy reasons.

May be useful.
Next Post Previous Post
No Comment
Add Comment
comment url