• Resolved bbogart

    (@bbogart)


    Using version 2.0.10 It looks like there is a test for a primacy menu and when there is no primary menu show a list of pages instead. I have a non-primary sidebar menu that I want to use as a widget so I can have custom HTML above it. After an unknown update, I see a list of pages above my two sidebar widgets. What was the rationale for this change? I’ve manually changed the code as follows to fix the issue for my approach so that I have a widget above the menu:

    Lines 78–94:

    <ul class="site-nav reset-list-style" id="main-menu" role="navigation">
    							<?php
    							if ( has_nav_menu( 'primary-menu' ) ) {
    								wp_nav_menu( array(
    									'container' 		=> '',
    									'items_wrap' 		=> '%3$s',
    									'theme_location' 	=> 'primary-menu',
    								) );
    							} else {
    								// Removed by bbogart
    								//wp_list_pages( array(
    								//	'container' => '',
    								//	'title_li' 	=> '',
    								//) );
    							}
    							?>
    						</ul>
Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter bbogart

    (@bbogart)

    I also had to change it for the mobile menu:

    Lines 163-179 (header.php)

    `<ul class=”site-nav reset-list-style” id=”mobile-menu” role=”navigation”>
    <?php
    if ( has_nav_menu( ‘mobile-menu’ ) ) {
    wp_nav_menu( array(
    ‘container’ => ”,
    ‘items_wrap’ => ‘%3$s’,
    ‘theme_location’ => ‘mobile-menu’,
    ) );
    } else {
    // Removed by bbogart
    //wp_list_pages( array(
    // ‘container’ => ”,
    // ‘title_li’ => ”,
    //) );
    }
    ?>
    </ul>`

    Theme Author Anders Norén

    (@anlino)

    Hi @bbogart,

    It’s pretty common for WordPress themes to show a fallback of pages if no primary menu is set (I believe most of the default WordPress themes do so, for example), and Koji has included a fallback since it was released.

    If you don’t want anything to be output in the menu area, you can create an empty menu in Appearance → Menus, and assign it to the “Primary Menu” and “Mobile Menu” display locations. If you do, the menu area won’t output anything on the front-end.

    — Anders

    Thread Starter bbogart

    (@bbogart)

    Thanks Anders,

    hmm. I’m certain there was no list of pages in my menu when I first switched to Koji, and I visit the site pretty often to check on things I think I would have noticed if this had changed long ago. Is it possible I had some kind of workaround (like an empty primary menu) already in place that no longer worked due to an update in WP itself? I can see you rationale, what does not make sense is why this changed for me where a list of pages suddenly appeared in my menu without me making any changes…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Why show list of pages when there is no primary menu?’ is closed to new replies.