Blogger Conditional Statements can be used to control the display of HTML elements on certain pages or to set different styles for different Pages. Some questions that are most asked are : How to Show bloggerwidget on homepage only? How can I show widgets only on sub pages? How can I hide widgets on Static pages? How to show widgets on selected pages in blogger? To answer all these questions today's tutorial will be a delicious one. Its really important to control widget Display in Blogger using Blogger Conditional Statements. Some widgets are meant for homepage only while some makes sense when you show it at your Contact Pages, About Me pages or static pages. So how do we actually set the conditional where to display an HTML element or widget and where to hide it? The trick is really simple. You just need to enclose your widgets in few pieces of conditional statements. So lets jump straight on how to manage widgets on different pages in blogger
Note:
where WIDGET CODE GOES HERE is the code of the widget you want to show or hide.
Sometimes you would prefer showing a Featured or Latest ribbon image on the first post or you may wish to display some stuff only on first post summary, in that case you can surely enclose the HTML inside the above conditional statement.
Index pages include labels/search pages, archive pages and the Homepage. To show widget or HTML on these pages use the following syntax,
That’s it. Do the same for applying any controlling code. I hope this was useful :)
UPDATE Now you can use Conditional tags even for Mobile Devices!
Its often the HTML/JavaScript widget that is widely used for adding your customized widgets to Blogger and its mostly this widget that needs to be easily managed. Since you often paste some widget code inside HTML/JavaScript widgets so the only extra thing that you need to do in order to control widget’s display is to enclose that code between two pieces of code as shown in each control codes below,
- Item Pages Include Posts only
- Index Pages Include Homepage and Search/Label Pages
How to Show Widgets/HTML Only On Homepages?
Simply enclose the code inside HTML/JavaScript widget between these conditional lines,where WIDGET CODE GOES HERE is the code of the widget you want to show or hide.
How to Hide Widgets On Homepages?
Same procedure here,How To Show Widgets Only On Static Pages?
How To Hide Widgets On Static Pages?
How To Show a Widget On a Selected Post Only?
How To Hide a Widget On a Selected Post?
How to Show HTML On First Post of Homepage?
If you want to show HTML content on first post of your homepage and not on every post that are displayed on homepage then use the following syntax,Sometimes you would prefer showing a Featured or Latest ribbon image on the first post or you may wish to display some stuff only on first post summary, in that case you can surely enclose the HTML inside the above conditional statement.
How to Show Widget On Index Page?
Index pages include labels/search pages, archive pages and the Homepage. To show widget or HTML on these pages use the following syntax,
How to Hide Widget On Index Pages?
Use this code
How to Show Widget On Search Page?
Search Page in Blogger blogs include all Label Pages and search pages displayed when a user searches a query using the search box. To show widget or HTML on search pages use the following syntax,How To Control Blogger’s Official Widgets?
The same procedure can be applied to Blogger’s official widgets like About Me, Archives, Poll etc. For controlling that widgets do this,- Go To Blogger > Design > Edit HTML
- Backup your template
- Check the Expand Widgets Templates Box
- Search for the title of the widget you want to control
- The code for the widget will look something similar to this one,
That’s it. Do the same for applying any controlling code. I hope this was useful :)
0 Comments