The Latest Blogger Conditional Tags And Their Functions

What is a Conditional Tag? Conditional tags or commonly called Conditional tags is an HTML programming language that gives commands to load or display widgets, CSS, JS or HTML in accordance with the commands on the conditional tags.

The Latest Conditional Tags, Functions and Their Use
Below is the latest conditional tag that you can apply to your blog if you want to replace the old conditional tags in your template. This new conditional tag version is simpler. Looks shorter than the previous conditional tag.

1. Homepage Conditional Tag (Main Page)
Display CSS, Widget, Js etc. data only on the Main page

<b:if cond='data:view.isHomepage'>

2. Conditional Page Index Tags
Display widgets, css, html, js only on the index page.

<b:if cond='data:view.isMultipleItems'>

3. Tag the Conditional Page Items
Display widgets, css, html, js only on the item page

<b:if cond='data:view.isSingleItem'>

4. Conditional Tag Page Posting
Showing widgets, css, html, js only on the posting page

<b:if cond='data:view.isPost'>

5. Static Page Conditional Tags (Page)
Display widgets, css, html, js only on static pages

<b:if cond='data:view.isPage'>

6. Conditional Tag Page Label
Display widgets, css, html, js only on the label page

<b:if cond='data:view.isLabelSearch'>

7. Pages with certain labels
Only bring up certain types of labels according to the command conditional tags.

<b:if cond='data:view.search.label == &quot;One-Label&quot;'></b:if>

8. Conditional Tag Page Search
Display widgets, css, html, js only on the label page

<!-- Includes a label search page -->
<b:if cond='data:view.isSearch'>
<!-- Search page only -->
<b:if cond='data:view.isSearch and !data:view.isLabelSearch'> 


9. Tag the Conditional Page Archive
Display widgets, css, html, js only in the Archive page

<b:if cond='data:view.isArchive'>

10. Conditional Tag Page Error 404 (Page Not Found)
Showing widgets, css, html, js only on the error page

<b:if cond='data:view.isError'>

11. Conditional Tag Page Preview (Preview)
Display widgets, css, html, js only on the preview page

<b:if cond='data:view.isPreview'>

Conditional Tags Out of Condition (Exceptions)
Conditional Tags previously functioned to put code elements (HTML, CSS, JS, Widgets etc.) in a condition. So that the tags are out of a condition, then simply by changing the code == to !=  Example:

<b:if cond='data:blog.pageType != &quot;index&quot;'></b:if>

Index pages are homepage, search, label and archive pages. So with the tag above, it will be outside the index page. So pages like posts and static pages will appear.

For the latest version, you can use the code! or notes where the code placement is placed in front. Example:

<b:if cond='!data:view.isMultipleItems'></b:if> Or <b:if cond='not data:view.isMultipleItems'></b:if>


Combining Conditional Tags - Multi Tags
How to combine 2 tags at once, but the function remains the same. Here's an example:

<b:if cond='data:blog.pageType != &quot;item&quot; or data:blog.pageType != &quot;static_page&quot;'></b:if>


The tag above means it will appear on the page outside the item and static_page. The meaning of or is if one of them is true then the condition will be displayed. If you have to under certain conditions then use and.

To combine multiple page urls on certain page tags or for multiple urls:

<b:if cond='data:view.url in {&quot;Url page A&quot;,&quot;Url page B&quot;,&quot;Url page so on&quot;}'></b:if>

Notice there is a comma ,. On the other hand you can use and, which means that if the usage of the two / more conditions is correct, it will be displayed. If one is incorrect then it will not be displayed.

If it's incorrect, display another <b:else>
If displaying differently on different pages don't have to use two conditional tags.
The way

<b:if cond='data:blog.pageType == &quot;item&quot;'> 1 <b:else/> 2 </b:if>


will be found on the post page. But if the page isn't posted it will use 2. So the function is for the exception of the code above.

Tag <b:else/> whose placement is always in line with
<b:if>. <b:else> can be interpreted as "and also" or "can also" command. Then the example of application can be like this:


<b:if cond='data:view.isHomepage'>  
[...content1...]  
<b:else />  
[...content2...]
</b:if> 


Maybe the picture above can give you a little shadow about how to place conditional and b: else tags and their functions.

Special Conditional Tags Mobile Page Or /?M=1
Displays CSS, JSS views, Specifically for the mobile version

<b:if cond='data:mobile'>

Post a Comment

Previous Post Next Post