Support » Fixing WordPress » Display different custom menus depending on page.

  • Hi All,

    I’m working on my very first Word Press Web Site and am a newbie to programming — trying to learn it though because I love what you can do with PHP 🙂

    My challenge is I’m using WordPress 3.1 – Graphene Template, and I have a main navigation going across the page horizontally, which has links to different Word Press pages. Now when I click on any of the pages, I would like to display a custom menu for that page in the sidebar. I don’t believe that this can be accomplished using the GUI. I’ve googled for 3 hours and either didn’t find or understand proposed solutions to this issue.

    If I add a custom menu, it shows up on every page — I’d like to somehow tell each page to display a specific custom menu, and if one isn’t specified, it should default to displaying no custom menu in the sidebar.

    Your help will be much appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Kathryn


    Automattic Happiness Engineer

    You can do this with conditionals.

    Example, in header.php (or whatever file your default menu is):

    <?php if (is_page('your-page-slug')): ?>
    put your custom menu code here
    <?php endif; ?>

    Use PHP if/else syntax:

    Zoonini — thank you so much for responding and I’m sorry I didn’t get a chance to get back to you sooner. When I say newbie, I’m really a newbie — can you direct me to where I would modify the header.php code? Can you share an example if my page is called Page1 and I’d like it to be linked to CustomMenu1, where would I go to link the two?

    Actually — 🙂 you’ll be proud

    I added this code into my header.php file

    <?php if (is_page(‘Services’)): ?>
    <?php wp_nav_menu(‘menu=test’); ?>
    <?php endif; ?>

    and it appears to be working, but it’s showing the menu outside of the page up on top… where in the headers.php file would I need to paste this code?

    ok, i’m getting somewhere, but my idea was to display my custom menu on the left column, not across the top under the main navigation…

    so my links are

    about us services contact

    if I add the code above to headers.php file what happens is my test menu shows up when i click on services, and then mouse over it as in:

    about us services contact
    item1 item2

    I’m using the graphene template…

    how could I redirect this custom menu to show up as a widget on the left side so when I click services

    to the left of the main body in the left column, you’ll see

    I guess what I mean is if I go into widgets, I have a custom menu widget and I can add it to the sidebar… how can I add multiple menus to the sidebar and only show those on the sidebar column only that pertains to each specific page?


    You can add that code into your ‘sidepbar.php’ file and it will do as you wish.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Display different custom menus depending on page.’ is closed to new replies.