• Hi, I’ve just installed this theme and want to only keep the some widgets in the sidebar on the front page and some on the post pages. At the moment all of them are on the front page and on all the posts..how do i change this? thanks and sorry for being such a novice!!!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you please post a link to your site and explain exactly which widgets you want on your front page and which ones you want on your post pages? What about your normal, non-post pages, do you have any on your site? This would usually be something like an About Me type of page.

    You can easily do what you want using CSS. Each widget will have a unique identifier associated with it, and each page also has a unique ID that’s associated with it, as well as general class names which correspond to what type of page it is.

    Thread Starter Jushilicious

    (@jushilicious)

    my site is touristmemoirs.com . All the widgets on the front page are on the post pages and on other pages. For example I don’t want the ‘About’ widget on posts.
    I also wanted a static front page but couldn’t quite get the widgets to be placed in the right places so have opted for the blog layout for now.
    Could you explain how I can edit the CSS? thank you!!

    Could you explain how I can edit the CSS?

    It looks like you have Jetpack installed, so you can use the Custom CSS option of JetPack to enter your CSS. Go to Jetpack → Settings and activate Custom CSS. You will then have a menu item under Appearance called Edit CSS. That’s where you will enter your CSS.

    As I mentioned previously, each type of page will have a particular “class” name, and each widget has a unique ID, so you can combine the two to hide or display widgets. The front page will always have a class assigned to it called home. To find out what the unique ID is for each of your widgets, you can either use a web debugging tool like Firebug or Chrome Developer Tools, or you can do a view source on one of your pages and look for the string <aside. For example, the About widget has an ID of sugarspice_about_widget-3.

    So, the way I would make the About widget appear on just the front page is to add these two rules to your custom CSS (go to Appearance → Edit CSS and copy & paste this at the very end):

    #sugarspice_about_widget-3 {
       display: none;
    }
    
    .home #sugarspice_about_widget-3 {
       display: block;
    }

    IDs have a hashtag (or pound sign #) placed before their name, while classes have a period (.) placed before their name.

    The first rule hides the About widget by default. The second rule then displays the widget on the home page.

    Let’s say you want the Top Posts to appear on all of your pages except for the home page. Then you just need to add one rule:

    .home #top-posts-2 {
       display: none;
    }

    This rule would hide the Top Posts widget on just the home page, it would continue to be displayed on all other pages.

    Thread Starter Jushilicious

    (@jushilicious)

    Thank you that’s extremely helpful, will let you know how I get on. Thanks again!

    Theme Author alex27

    (@alex27)

    Jetpack plugin has this nifty feature called Widget Visibility, that let’s you set conditions to display widgets only on certain pages, no coding required. I’d recommend checking it out.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Widgets wanted only on front page not posts’ is closed to new replies.