Home » » Make Widget show only in home page or post page

Make Widget show only in home page or post page

This time I will share some tutorial about blogging, How to make widget only show in Home Page or Post. This trick very useful to make loading page faster also make our blog template more elegant.
The concept to make widget only show in home page or post page, just need to put a little code like this bellow in your template or widget HTML. Check this one :

1. If you need to show the widget only in homepage, you need put this code between your widget code :
<b:if cond='data:blog.url == data:blog.homepageUrl'>
“Your widget code here”
</b:if>
2. And if you need to show your widget only in post page, you need put this code :
<b:if cond='data:blog.pageType == &quot;item&quot;'>
“Your widget code here”
</b:if>
To make you more understand about this tutorial, this is the application in tamplate HTML. Login into your blogger account ==> edit HTML ==> Expand Template Widget. Try to fine some code like this <b:widget id=
This bellow the complete one (example)
<b:widget id='HTML14' locked='false' title='Artikel Terkait' 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 != &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>
The red code is code that you must put, in this case, this widget will be displayed only in homepage. If you need to make it display in post page, just replace the red code with code that I give in above. If you don’t wont to edit via template HTML, you can edit or add this code via layout. Just open your widget HTML code, and put which one code you need. Just easy, right???

Related Articles



Jika Anda menyukai Artikel di blog ini, Silahkan klik disini untuk berlangganan gratis via email, dengan begitu Anda akan mendapat kiriman artikel setiap ada artikel yang terbit di My World Is Yours

0 comments:

 
Copyright © 2011. My World Is Yours - All Rights Reserved
Template Modify by My World Is Yours
Proudly powered by Blogger