WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am currently building a wordpress theme. For the menu, I just want to display all the pages that are created in the order that they are created in (i.e. I don't want users to have to go into the 'menu' section of the site and create their own).

I tried using wp_page_menu and this worked HOWEVER I need to add a walker class to expand the functionality, which you can't do with this function. So I need a way to display all my pages with using wp_nav_menu as my code - is there a way to do this?

Here is my code currently:

<nav id="nav">
    <?php wp_nav_menu( array( 'walker' => new Clapton_Nav_Walker ) ); ?>
share|improve this question

You could move away from wp_nav_menu() completely and instead use wp_list_pages().

See the codex for more information, but I believe this may be what you are looking for.


I do understand that this function outputs the pages. The point I was trying to make though is that you can use this in conjunction with CSS to get it looking like a menu. I made an example page that includes this code:

* Template Name: Testing
    <link rel="stylesheet" type="text/css" href="http://nickyoungweb.com/zip/wp-content/themes/THS2012/style.css" />
    <nav id="nav">
            wp_list_pages( array(
                'title_li' => ''
       <br style="clear: both; ">

I have it linked to a stylesheet that contains this code:

    /**** WP LIST PAGES NAV *****/
    nav {  }
    nav li { list-style-type: none; float: left; }
    nav li a { width: 50px; height: 30px; background: #000; color: #fff; padding: 10px; margin: 2px; }
    nav li a:hover { background: #f00; color: #000; }
    nav ul li { display: none; }

It is a very basic example of how you could make it work with this function. You can see the example at this link: http://nickyoungweb.com/page-nav-example/

Hopefully this helps clear up any confusion I might have caused you and also gives you an idea of how it CAN be done with this function.

share|improve this answer
How this will be beneficial? It will just list the pages not a menu. – Chittaranjan May 20 '14 at 9:25
Yes it will list all of the pages as the OP wishes to do. There is also an argument for a walker and it can be styled to look like a navigation menu. – Nick Young May 20 '14 at 9:27
Thanks for this suggestions, but @Chittaranjan is correct, it only outputs the pages, it doesn't act like a menu – Sam Skirrow May 20 '14 at 10:16
Updated my answer to show a better example of how this could actually work. Link included as a basic example of a menu created using wp_list_pages(). Hope it helps. – Nick Young May 22 '14 at 8:45

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.