WordPress.org

Ready to get started?Download WordPress

Forums

Sub Menu not Showing up on Post's Page (2 posts)

  1. FLOAT333
    Member
    Posted 1 year ago #

    Hello,

    I have been looking around the forums searching for this answer and cannot find it.

    I have 5 menus in my theme and cannot get one to display in my posts/blog section (do not want to use widgets)

    My code for registration is:

    function register_my_menus() {
      register_nav_menus(
        array(
          'header-menu' => __( 'Header Menu' ),
    	  'services-menu' => __( 'Services Menu' ),
    	  'portfolio-menu' => __( 'Projects Menu' ),
    	  'blog-menu' => __( 'Blog Menu' ),
          'footer-menu' => __( 'Footer Menu' )
        )
      );
    }
    add_action( 'init', 'register_my_menus' );

    All is good in the menus appearing in the backend and to select the location.

    I have this:

    if (is_page(array('services','web-design-development','search-engine-optimization','social-media-networking','ad-campaigns','e-commerce','our-pricing'))){
    		echo '<div class="container" id="sub-menu">
    	<div class="wrap">';
    		wp_nav_menu(array('theme_location'=>'services-menu' ));
    		echo '</div></div>';
    	} elseif (is_page(array('our-projects','web-site-design','graphic-design'))){
    		echo '<div class="container" id="sub-menu">
    	<div class="wrap">';
    		wp_nav_menu(array('theme_location'=>'portfolio-menu' ));
    		echo '</div></div>';
    	} elseif (is_page('blog')){
    		echo '<div class="container" id="sub-menu">
    	<div class="wrap">';
    		wp_nav_menu(array('theme_location'=>'blog-menu' ));
    		echo '</div></div>';
    	}

    in my header.php file.

    I have a template page blog.php that is being used for my Blog page created in Pages tab and selected as Posts static page. However the menu is not displayed on that page. But it shows up should I change blog to say my contact-us slug.

    Any help is much appreciated.

  2. ssalenger
    Member
    Posted 1 year ago #

    I'm having a similar problem. Were you able to resolve this?

Topic Closed

This topic has been closed to new replies.

About this Topic