Support » Fixing WordPress » Question about wp_list_pages

  • At , I have a navigation bar on the top of the page. I’m using wp_list_pages to show the different pages on the WordPress blog, and wp_list_categories to show a dropdown of all the categories.

    The dropdown for the categories works flawlessly. However, I’m having trouble adapting my code to also do the dropdown for pages that have children. Not all of my pages have children.

    I’ve been reworking the code at for the past couple hours but not really made any headway.

    Currently, this is the code that my template is using in its header.php:

    <div class="content">
       <ul id="navmenu-h">
          <li><a href="<?php echo get_settings('home'); ?>">Home</a></li>
          <?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
          <?php wp_list_categories('orderby=name&title_li=<a>Categories</a>'); ?>
          <li class="alignright"><a href="<?php bloginfo('rss2_url'); ?>">Subscribe via RSS</a></li>

    I’ve tried all kinds of modifications of this using the guidance from Codex, but I’m not getting anywhere.

    Is there a wordpress and PHP expert here who can reply with some specific guidance about what I should change in my code?

    To recap, I have:
    Page 1
    Page 2
    Subpage 1
    Subpage 2
    Subpage 3
    Subpage 4
    Page 3
    Subpage 1
    Subpage 2
    Page 4

    …and so forth. What do I need to do with my code to make it display the pages, and also the list of subpages (for the pages that have children)?

    Your help would be most sincerely appreciated.


Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Question about wp_list_pages’ is closed to new replies.