WordPress.org

Ready to get started?Download WordPress

Forums

How to get different menus to display on different pages (1 post)

  1. bokin
    Member
    Posted 7 months ago #

    I am using this theme:
    http://spyropress.com/demo/?product=magician

    I am trying to get the primary menu (menu bar) to display a different set of links depending on which page you are on.
    For instance, if you are on the "Military" page if will display a certain menu in the primary menu section. If you are on the "Residential" page it will display a different array of links from the Military page but in the same area.
    I have created the custom menus for what I want displayed on each page. I just need to implement them.

    I've read a ton of different forums for an answer and I am lost.
    I've tried editing the functions and header php but nothing has worked yet. The functionality of the menu in this theme seems to be called up in the index.php:

    <nav id="navigation">    
    
    <?php
    
        spyropress_logo( array(
    
            'brand' => true,
    
            'link' => is_front_page() ? '#home' : home_url('/#home')
    
        ) );
    
        if( has_nav_menu( 'primary' ) ) {
    
            $menu = spyropress_get_nav_menu( array(
    
                        'menu_id' => 'menu',
    
                        'container' => false,
    
                        'echo' => false,
    
                        'menu_class' =>false,
    
                    ));
    
            $url = is_front_page() ? '#' : home_url('/#');
    
            echo str_replace( '#HOME_URL#', $url, $menu );
    
        }
    
    ?>
    
    </nav>

    (I'm not very technical when it comes to php so please be specific in your reply on where I am changing/adding things)
    Thanks!!

Reply

You must log in to post.

About this Topic