Conditional Widgets

  • Author
  • #24608


    You can show/hide widgets on different parts of your blog. For instance:

    body.home li#text-1 {

    This rule will hide the Text 1 widget on your blog’s home page. Every kind of page has a body class; every widget has an ID and/or classes.

    Hat tip:


    i can think of some wp-hackers who’ll find that interesting ;)

    very cool.


    so since Sandbox already displays pages as a menu, perhaps the thing to do for blogs with lots of subpages is to set
    li#pages { display:none } for everything except



    Or you could set Widgets in both sidebars and simply leave out the pages list.

    As a reference for users, there is a « Home link that appears on pages that are not the home: li.home-link. Also, by default the meta information (login, register, etc.) only appears on the home page, li.meta-links.

    Thanks for sharing this great idea, Andy.

The topic ‘Conditional Widgets’ is closed to new replies.