Support » Themes and Templates » Different sidebar per page

  • Hi,

    Is there a clean way to have a different side bar, or content in the side bar for a range of pages?

    I have a range of 10 products and in the sidebar I want to put the spec for each product.

    The only way I can think of is to have a template for each product page and put the spec data in each template – ie. have 10 templates.

    Surely there is a better way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Not sure what form of information you need to put in the sidebar, but the Widget Logic plugin might work for you.

    If you can add the product information to a text or other type of widget (FYI various plugins allow full PHP code in text widgets; Otto from these forums has a good one, Exec-PHP is another good one), you could then use Widget Logic to force a certain widget to appear only on a certain page(s) using is_page().

    Alternatively, you could hardcode your sidebar.php or page.php files to get the same functionality, using if statements and is_page().

    For a similar example, I use a custom Google search on my site, but Google doesn’t allow the results to be any less than 795px wide, which is nearly the width of my content div PLUS my sidebars. So in page.php, I check to see if I’m on the search results page, and if so, I block the sidebar generation for that page.

    These are the only ways I’m familiar with. Someone with some coding experience might have a better way.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Different sidebar per page’ is closed to new replies.