Get to know the conditional tag code and its functions

Get to know the conditional tag code and its functions - This tutorial has actually been around for a long time, but it's still often used by blogger designs

When we are heading to someone's blog, it appears that the widget display on the blog is sometimes interchangeable. For example, on the front page of Wigdet A, on the other page Widgets A does not appear. What's wrong....

Actually, there are several ways that are done by bloggers to do this. This means displaying specific widgets on certain pages. Want to know?

Here's how to do it in general (these tips are intended to enhance the appearance of the blog).

1. Display the widget only on the front page (homepage)


<b:if cond = 'data: blog.url == data: blog.homepageUrl'>
................. .....................................
</ b: if>


2. Displays all pages except homepage.


<b:if cond = 'data: blog.url! = data: blog.homepageUrl'>
............................. .........................
</ b: if>


3. Display the widget only on the Archive page.


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


4. Displays widgets on all pages except the archive page.


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


5. Displays widgets only on the post page.


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


6. Displays widgets on all pages except the posting page.


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


7. Display the widget only in certain posts.


<b:if cond = 'data: blog.pageType == &quot;post-address&quot;'>
............................ ..........................
</ b:if>


8. Displays widgets other than certain posts.


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


9. Displays widgets only on staticpages pages.


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


10. Displays widgets on all pages, except pages staticpages.


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

Note: The dot above is the widget code that needs to be placed.

For example, pay attention below.
Try you to the world of Sarah . On the front page Facebook Fan Widget does not appear. Then on the second page when clicking on an article, the Facebook Fan Widget appears. To do that please try the following steps.

Display Specific Widgets On Specific Pages
  1. Of course you have to open your own blog account.
  2.  Enter the Template Element . Then click Edit HTML
  3. Look for widgets that you hide (before you have installed widgets in your blog).
  4. For example the Facebook Fan Widget. Please look for the words "Fan Facebook" (use Ctrl + F to search quickly)
  5. Once found, the code will appear exactly as below.


  6. <b:widget id='HTML4' locked='false' title='Fan Facebook' type='HTML'> <b:includable id='main'><!-- only display title if it's non-empty --><b:if cond='data:title != &quot;&quot;'><h2 class='title'><data:title/></h2></b:if><div class='widget-content'><data:content/></div><b:include name='quickedit'/> </b:includable> </b:widget>
    


  7. Next add the code

  8. <b:if cond='data:blog.pageType == &quot;item&quot;'>

    before the code
    <!-- only display title if it's non-empty --> 

  9. After adding then enter the code
  10. before the code
    </b:includable>
    </b:widget>


  11. Then the results will be exactly as below.

  12. <b:widget id='HTML4' locked='false' title='Fan Facebook' type='HTML'> <b:includable id='main'><b:if cond='data:blog.pageType == &quot;item&quot;'><!-- only display title if it's non-empty --><b:if cond='data:title != &quot;&quot;'><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>


  13. Done. Save your blog template.


Post a Comment

Previous Post Next Post