Secret Manner

This Blog Provides Information About Blog, Blog Tips, Ways And Others

How to Display Widgets Only in Homepage / Page Posts

When setting up the design of the blog, we sometimes plagued with many widgets are displayed, so the widget looks crammed and pages to be so long. In other cases, sometimes we just want certain widgets appear only on specific pages, either the homepage, static pages, as well as post pages only. I used to talk about how to hide the Blogger sidebar on certain pages, by using conditional tags and CSS (display), and if you want only to hide one or several widgets, then certainly less precise when applied. So, on this occasion, I would like to share about  how show or hide one or several widgets in a particular page, and other pages displays on the type.
Concept Hack Displays Widgets On Specific Page
This method is still the same as the previous article I mentioned, the use of conditional tags (if b), one of the Blogger XML tags, to give orders to an element displayed on the / certain pages and hide it in the / other pages. Conditional (if) is also known as its use in PHP, and is also known in English (the if clause, a conditional sentence) hehehehe ..... The difference with the previous way, the way that I have to offer is not going to use CSS, but using conditional tags directly on elements to be given the command, which in this case is the widget elements.
Showing steps Widgets On Specific Page
1 Finding ID Widget
Before giving the conditional tags, you must know the widget ID to be displayed on any given page. How to find it very easily:
a. There are two ways to access the editor widget (actually there are three, namely through the edit HTML, but how it will be more complicated:
- If you are in a state Blogger login, you can directly access the "quickedit" directly from the blog page, quickedit is a tool for editing widget directly, is usually located in the lower right corner of the widget, a screwdriver and a key icon (screwdriver and wrench). Click the icon to the desired widget and will appear a pop-up window where you can edit the content widget.
- Or access the editor widget through the page "Layout", then click on the link "Edit" on one of the widgets. Then will appear a pop-up window.
b. Look in the URL / address in a browser window pop up on the page. The layout of the widget ID is at the end of the URL (the URL slide to the right). Consider the example shown below:
www.secretmanner.com
d. Id save the widget, for example, from the above example, Id widget that I want to edit is "HTML11".
2 Gives Conditional Tags In Element Widget
To display a widget on certain pages, you must add the conditional tags (if cond b) the elements of the desired widget. Add the following steps in accordance with the example of a widget that has been presented above:
a. Log into the page template (Dashboard> Template)
b. Click the "Edit HTML"> Proceed.
c. Do not forget to click / check "Expand Widget Templates" to display all elements in the editor widget.
d. Press CTRL + F, enter the desired widget ID that has previously been sought after and prepared. In this example I will use the widget id "HTML11" as an example and follows more or less elements buddy widget:
open-rahasia.blogspot.com
e. Then add a conditional tag after <b: includable id = 'main'> and before the closing tag </ b: includable>. Here conditional tags based on page types and how to add it, note red tag and that is what should be added:
How to Display Widgets Only in Home / Index (Homepage)

<b: widget id = 'HTML11' locked = 'false' title = '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>

How to Display Widgets Only in Home Page Posts

<b: widget id = 'HTML11' locked = 'false' title = '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! = & 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>

How to Display Widgets only in Static Pages

<b: widget id = 'HTML11' locked = 'false' title = '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! = & 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>
How to Display Widgets Only in Home Page Archive (Archive)

<b: widget id = 'HTML11' locked = 'false' title = '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! = & 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>

How to Display Widgets Only on One Page (Based on URL)

<b: widget id = 'HTML11' locked = 'false' title = 'type =' HTML '>
<b: includable id = 'main'>
<b: if cond = 'data: blog.url == "Change the page URL here"'>
   <! - 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>

f. After conditional tags are added, save the template.

If you want to do the same thing on some widgets, you have to perform and repeat the same manner as above: find ID widget, search widget element corresponding ID in the edit HTML, and insert conditional tags based on the type of page to the widget element. Save and Done.
Bagikan :
+
Previous
Next Post »
0 Komentar untuk "How to Display Widgets Only in Homepage / Page Posts "

 
Template By Kunci Dunia
Back To Top