Changing Primary Menu for Different Pages

  • Author
    Posts
  • #28085
    Wes Dickson

    Hi, I’m trying to have different primary menus appear on different pages. I want the different menu to be just like the one that’s on the main page of my Parabola template, except with links to different pages of course.

    I found this wordpress forum, in which someone named Teknohippy has figured it all out: https://wordpress.org/support/topic/custom-menus-on-different-pages

    However, I cannot figure out where to put the code that he has created:
    <?php wp_nav_menu( array( ‘container’ => ‘none’, ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’, ‘menu’ => get_post_meta( $post->ID, ‘MenuName’, true) ) ); ?>

    He says to place it in the header.php file, and another poster, who has successfully done so on the TwentyTen theme, says that he changed the original code in the header.php from
    Original Code Line: <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>
    To Revised Code Line: <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’, ‘menu’ => get_post_meta( $post->ID, ‘MenuName’, true) ) );?>

    And apparently it worked.

    However, on the Parabola theme’s header.php, I find nothing like this. This seems to be the only code for the menu:
    <span> </span>
    <nav id=”access” role=”navigation”>

    <?php cryout_access_hook();?>

    </nav><!– #access –>

    I’ve tried pasting Teknohippy’s code into various spots here, but all I get is an additional, one that is either a list or an unresponsive version of the Parabola menu.

    Any ideas? Any solutions?
    All help is appreciated greatly!!!

    #28087
    Wes Dickson

    Ok, so I found this code in theme-setup.php

    wp_nav_menu( array( ‘container_class’ => ‘menu’, ‘menu_id’ =>’prime_nav’, ‘theme_location’ => ‘primary’,’link_before’ => ‘<span>’, ‘link_after’ => ‘</span>’ ) );

    and it’s very similar to the Original Code noted in the reputedly successful example above.

    It looks like the main thing I need to add to this code is this bit:

    ‘menu’ => get_post_meta( $post->ID, ‘MenuName’, true)

    However, when I added it in, trying various locations, my theme crashed and I had to delete and reinstall.

    I’m guessing there’s a conflict because menu_id is being defined as prime_nav, but I’m also trying to define “menu” with the inserted code. I tried overwriting the prime_nav definition, but that didn’t work either. I’m guessing it refers to prime_nav somewhere else in the code (though I’ve had no luck finding it).

    Any help out there?
    I’m just a beginner, so be gentle with me…

    #28650
    sve

    With this plugin it’s OK , it’s works with Parabola
    CE WP-Menu per Page

    #28652
    Walt

    “my theme crashed and I had to delete and reinstall.”

    Reuploading the file that you edited via FTP was too difficult I guess?

Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Changing Primary Menu for Different Pages’ is closed to new replies.