Theme Layout

Theme Translation

Trending Posts Display

Home Layout Display

Posts Title Display

404

We Are Sorry, Page Not Found

Home Page
When you create a blog, you may want to show some widgets in some pages, and some widgets will display on the specified page. Also, such a widget is necessary for AdSense ads to display on some pages or not. In such a situation, you have to add some code for any specific widget or section. Here I will present both topics in today's post. For bloggers such as show or hide widgets on specific pages, it will also apply to home pages, post pages, static pages, archive pages and even on posts, etc.

In Blogger, to show or hide the widget or section on specific pages, you need to add a conditional statement in the code format, and you need to add this code inside that particular widget code in the blogger templates code area. Which is a straightforward and easy task to do, so that you can take some time to understand it.

How To Show or Hide Widgets On Specific Page?

STEP 01:
First of all, find out the code of that specific widget that will show or hide.


Notice that the code for a widget on your blog is such:

<b:widget id= 'HTML11' locked='false' title='Popular posts' type='HTML'>
  <b:includable id='main'>

    < ------ all widget code ------- >

  </b:includable>
</b:widget>

Now, after adding the following code for Show or Hide, all the code will look like:

<b:widget id= 'HTML11' locked='false' title='Popular posts' type='HTML'>
   <b:includable id='main'>
   <b:if cond='data:blog.pageType == data:blog.homepageUrl'>

   < ------ all widget code ------- >

   </b:if>
  </b:includable>
</b:widget>

That Is To Say,
Add the following conditional code just below <b:includable id = 'main'> 
and just above </ b: includable>

How To Show or Hide Sections On Specific Pages?

Almost the same subject to show or hide blogger section because in this case, the following mentioned conditional codes will be required. But the type of usage will be a little different to show or hide any section in blogger.

For example:

<b:if cond='data:blog.url == data:blog.homepageUrl'>
Displays widgets/sections/styles between this tags only on homepage
</b:if> 

That is, the beginning of the conditional code and end of the conditional code will be subject to the conditional code type.

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

Thus, this section can contain any code, widgets/sections/styles, which will not show on the homepage

</b:if> 

Please see the picture to understand more details

All The Conditional Statement To Show or Hide In Blogger

To Show Blogger Widget only in Homepage


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

</b:if>

To Hide Blogger Widget only in Homepage


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

</b:if>

To Show a Widget only in Post Pages


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

</b:if>

To Hide a Widget only in Post Pages


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

</b:if>

To Show a Widget only in Static Pages


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

</b:if>

To Hide a Widget only in Static Pages


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

</b:if>

To Show a Widget only in Archive Pages


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

</b:if>

To hide a Widget only in Archive Pages


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

</b:if>

To Show a Widget only in a Specific Page or post


<b:if cond='data:blog.pageType == "URL of the page or post"'>

</b:if>
All of the above codes will be required many times in your blogging life, so copy them somewhere or don't forget to bookmark this page.

At The End

Hopefully, you understand how to make how to show or hide widgets or sections in Blogger. If there is a complexity, then you can write down the comment box below. Happy Blogging!
Leave A Reply

[name=Your Name Here] [img=Your Image Url Here] [description=Your Description Here] (facebook=Facebook Profile Url) (twitter=Twitter Profile Url) (instagram=Instagram Profile Url) (bloglovin=Blogvin Profile Url) (pinterest=Pinterest Profile Url) (tumblr=Tumblr Profile Url)
Subscribe Our Newsletter