Conditional Widgets

  • Author
    Posts
  • #24608

    andy
    Member

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

    body.home li#text-1 {
    display:none;
    }

    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: http://archaeoastronomy.wordpress.com/

    #24719

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

    very cool.

    #24720

    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 body.page

    #24740

    swallick
    Member

    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.