SHOW WIDGETS ONLY IN HOMEPAGE OR IN POST PAGES
Do you like this story?
Once you activate any widget, in your blog, it will be displayed in all the pages by default, including your homepage.
But sometimes, we do want to show some widgets only on Homepage or only for the individual posts pages, or only in a specific page, the coding is quite simple, but you need to customize the widget through the "Edit HTML" link in your "Layout" section.
Follow these steps:
Create any widget, and place it where-ever you want, and save the template. Check if it is working (should be displayed in all the pages). Remember to give a TITLE to it, like Archives/BlogRoll/Maps/Clock, anything unique.
Now go to "Edit HTML" page.
Click/mark "Expand Widget Templates"
Then find for that unique Title (by searching through CTRL+F method)
It will be something like this:
Now tweak this as follows
CASE #1
To SHOW the code/widget only in HomePage
CASE #2
To SHOW the widget in "All Posts", but NOT in HomePage
CASE #3
To SHOW the widget in any particular page
Add those code lines in red color, as per your requirement.
CASE #4
To HIDE a widget ONLY in a particular page/post, and to display it in all other pages of your blog, use this code (shown below is only the code in RED from the previous code):
.....................
CASE #5
To SHOW widgets only in Archive Pages
.....................
CASE #5
To SHOW widgets only in Static Pages
.....................
CASE #6
To HIDE widgets in Static Pages
.....................
This post was written by: Rajendra Prasad
Rajendra Prasad is a professional blogger, web designer and front end web developer. Follow him on Facebook