• I’ve built a theme with the stripped-down bones of Twenty Ten.

    The access menu at the top of the page – the main navigational structure – lists all the pages automatically. I need to exclude a few, and include them elsewhere on the site.

    I know that the usual way to do this is via <?php wp_list_pages(exclude=’x’) ?php>. However, in Twenty Ten the access menu doesn’t use wp_list_pages. It looks like this:

    <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>

    I have no idea how to put an exclude command in there. Has anyone done this before?

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • That function (wp_nav_manu()) is for the new custom navigation feature that was added in WordPress 3.0. With that in there you don’t need to alter the code to change your nav menu, you can do so in Appearance > Menus. Here’s the codex page for it. If you would rather do it in the code, you can just replace wp_nav_manu() with whatever you want.

    you could exclude pages by editing functions.php of twenty ten, and editing here:

    function twentyten_page_menu_args( $args ) {
    	$args['show_home'] = true;
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );

    for instance to exclude pages with id 3 and 17, change this to:

    function twentyten_page_menu_args( $args ) {
    	$args['show_home'] = true;
    	$args['exclude'] = '3,17';
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'twentyten_page_menu_args' );

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excluding pages from the access menu in Twenty Ten’ is closed to new replies.