How to Use conditional tags - Blogger, Conditional, Page Types, Tags, Guide, Codes, Ultimate Blogger Guide - 10- Bc Blog Teacher

Breaking

BANNER 728X90

30 Ekim 2020 Cuma

How to Use conditional tags - Blogger, Conditional, Page Types, Tags, Guide, Codes, Ultimate Blogger Guide

Blogger, Conditional, Page Types, Tags, Guide, Codes, Ultimate Blogger Guide 




  How to Use conditional tags

To apply a conditional tag to some content, simply put the content inside the opening <b:if cond…> and the closing </b:if> like:


<b:if cond='data:blog.pageType == "item"'>

    # THIS CONTENT WILL BE EXECUTED IF CONDITION IS TRUE

</b:if>

In the example above, the content will only appear on post pages.


The content can be a div, a section, a style tag or another conditional tag etc.


If you want to specify a alternate content (when the condition is false), you need to insert a <b:else/> tag followed by the content, like this:


<b:if cond='data:blog.pageType == "item"'>

    # THIS CONTENT WILL BE EXECUTED IF CONDITION IS TRUE

    # i.e. if current page is post (item) page

<b:else/>

    # THIS CONTENT WILL BE EXECUTED IF CONDITION IS FALSE

    # i.e. if not post page

</b:if>

The <b:else/> also works like an OR operator as explained above.



Hiç yorum yok:

Yorum Gönder