WordPress.org

Forums

[resolved] List subpages in WordPress navigation menu (13 posts)

  1. befree22
    Member
    Posted 3 years ago #

    Hi,

    I've read http://codex.wordpress.org/Function_Reference/wp_nav_menu and http://codex.wordpress.org/Template_Tags/wp_list_pages

    I'd like to list subpages in the navigation menu in header.php for the Photos page. My current navigation menu code at denisejacksonmusic.com is

    <?php wp_list_pages('title_li=&depth=1&sort_column=menu_order&exclude=69,75,84'); ?>

    I've tried adding the following code to header.php to list subpages for the top navigation menu at denisejacksonmusic.com but it's not working properly. I want to exclude the 3 pages listed in the above code.

    <?php
      $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
      if ($children) { ?>
      <ul>
      <?php echo $children; ?>
      </ul>
      <?php } ?>

    Could someone help me find the correct code so that I exclude exclude=69,75,84 from the navigation menu top pages and subpages?

  2. befree22
    Member
    Posted 3 years ago #

    Here's the full code for the current header.php filej

    [57 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]

  3. esmi
    Forum Moderator
    Posted 3 years ago #

    I'm sorry but as you are using a commercial theme, you need to seek support from the theme's vendors.
    http://ithemes.com/support/

  4. befree22
    Member
    Posted 3 years ago #

    To: Moderator

    I downloaded this theme for free a month ago. Their support forum isn't accepting new members. Thanks anyway.

  5. alvaro05
    Member
    Posted 3 years ago #

    Sorry, I can't help you with this. Try searching for a plugin:

    http://wordpress.org/extend/plugins/search.php?q=subpages

  6. befree22
    Member
    Posted 2 years ago #

    I'm using this 2012 child theme at this site and I have the latest WordPress update. I want to hardcode the top navigation menu links in header.php because the top nav menu keeps displaying ALL pages on the site whenever I make changes to the custom css. I added the menu pages in WP admin > Menu > Theme locations. I'm only using the top menu and the footer menu. The child theme came with the top menu and the lower menu (below the top menu) but I added the footer menu code from WP Codex.

    The code I added is this ...

    </nav><!-- #site-navigation -->
    <?php wp_list_pages('title_li=&depth=1&sort_column=menu_order&exclude=497,10,21,24,15,43,295,500,13'); ?>

    ...but it's not registering on the site yet. Is this code correct and I'm I adding it to the right spot in the header.php? The complete header.php code is http://pastebin.com/Le8KQJC3

  7. befree22
    Member
    Posted 2 years ago #

    <?php wp_list_pages('include=497,10,21,24,15,43,295,500,13&title_li=&depth=1&exclude=69,75'); ?>

    I'm trying the code above but it's still not registering. Two pages that I want to exclude from the top nav menu are Pages and Thank You. The Credits page should be listed before the Contact page. The page id's show the sort order for the pages. What am I missing?

    The pages are all sorted in WP admin > Menu > Theme locations several days ago.

  8. invot
    Member
    Posted 2 years ago #

    Can you send me a link to the site so I can see what might be the root of the problem?

  9. befree22
    Member
    Posted 2 years ago #

    It's here.

    WP admin interface permits you to specify the order in the WP admin > Appearance > Theme locations but I'm thinking that I also have to specify the order by editing the page details, ie. Pages > Page attributes which I'm working on.

    Still, I want to exclude the 2 pages mentioned above.

  10. invot
    Member
    Posted 2 years ago #

    Have you created the menus in the Menu section of the appearance tab or is the menu written directly in a php file? You should try the standard method of using wordpress menus before resorting to something complex.

    How to include a menu

  11. befree22
    Member
    Posted 2 years ago #

    I'm quite familiar using WP admin to add menus via WP admin > Menus > Theme location (see thread above). My issue is that ALL pages, and not just pages added to the top menu, are displaying on the site, namely the Privacy and Thank you pages.

    If you viewed the site, you'll see those 2 pages are included in the top menu but they don't appear in the WP admin > Menu > Theme location for the top/primary menu. This is why I wanted to resort to hardcoding the menu in the header.php.

    The related issue is that whenever I add this code to exclude the 2 pages from the top menu, I get a list of ALL pages displaying belowing the top menu:

    <?php wp_list_pages('exclude=69,75' ); ?>

  12. befree22
    Member
    Posted 2 years ago #

    I'm having the author of this 2012 child theme look into this issue.

  13. befree22
    Member
    Posted 2 years ago #

    Fixed by author. Although I had set the Primary Menu in WP Admin > Appearance, I forgot to uncheck the "Add top level menus automatically" in the menu options. Now the 2 pages aren't displaying in the Primary/Top menu.

    Thanks for your time.

Topic Closed

This topic has been closed to new replies.

About this Topic