Iklan

Some Function Conditional Tag Widget in Blogger

Some Function Conditional Tag Widget in Blogger

Multiple Functions Conditional Tag On Widget -There are a few tricks to hide elements of a good blog on the home page the homepage, posts, static pages or by adding conditional code * tag * in which every element you want to hide.

Examples of application:


HTML - Go Widget

<b:if cond='data:blog.pageType != "static_page"'>
..... The contents of the content to be wrapped in the conditional tag (Content will be hidden in the static pages) .....</b:if>

Not only hides an element but can also to display only certain elements in the page that you specify.

Examples of application:


HTML - Go Widget

<b:if cond='data:blog.url == data:blog.homepageUrl'>
..... The contents of the content to be wrapped in the conditional tag (Content will only appear on the home page) .....
</b:if>



For more details please refer to some function conditional tag for the widget below:


1. View the widget only on the home page:


HTML - Go Widget

<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. View the widget only on post pages:


HTML - Go Widget

<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 widgets only on specific pages:


HTML - Go Widget

<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: Your URL * Replace * with the address you want.

4. Hiding widgets only on specific pages:


HTML - Go Widget

<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. displaying widgets on the static page:


HTML - Go Widget

<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:


HTML - Go Widget

<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. widget displays only on archive pages:


HTML - Go Widget

<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>


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

Not limited to the widget, with conditional tags you can wrap Other elements such as * Script *, * CSS *, or * HTML * in the template for reason accelerate blog by reducing Script contained in a page or other privacy reasons.

May be useful.


Next
Prev Post
Previous
Next Post
Buka Komentar