Support » Fixing WordPress » Using conditional tags to display different menus

  • Hi all,

    I am working on a website for someone who does not like drop-down menus. On the top navigation, there is a row of menu items that will appear across the top of every page. There is also a second menu that goes down the sidebar of each page, but the sidebar menu needs to display different items depending on what page you are on:

    As you can see when you click on Home, About, or Studio from the top menu, I have used widget logic to set it up so that different menus display on each of these pages using the conditional tag is_page(‘page-name-goes-here’). However, I also want the menus to display when you click on any of the subpages along the sidebar of each of those sections.

    I have tried using the conditional tags is_page( array(139, 133, 137) ) and is_page( ‘139’, ‘133’, ‘137’ ) where the numbers are the different page numbers for each section but that didn’t work.

    Does anyone have any suggestions for conditional tags to display a series of different pages, or a better way to do this?

    Any advice would be appreciated.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Does anyone have any ideas on this?

    Could you use the List Pages Shortcodes plugin in conjunction with a text widget?

    Chip Bennett


    Theme Review Admin

    You can do it entirely via CSS, and calls to wp_list_pages().

    I use this technique in my Oenology Theme. You are welcome to borrow, steal, and modify the code to suit your needs. 🙂

    Here’s my template output.

    Here are the CSS definitions.

    Thanks for the help.

    Lockettpots — it looks as though those shortcodes are only to list pages in the content of a page and not the sidebar. I guess I could try making a new template for each page and call up the code in the sidebar, but some of the menus contain categories so I don’t think this will work since I need to be able to call the custom menu widgets.

    Chip — I am looking at what you sent and I am completely self-taught in PHP and CSS (just from reading tutorials)and I am not sure how to tweak the code to get the different menus on the different pages and their children… can you provide further guidance if you have a free moment?

    Thanks again for your replies!

    Chip Bennett


    Theme Review Admin

    @dhobeika: the best guidance I can give is the working code examples that I linked.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Using conditional tags to display different menus’ is closed to new replies.