• Resolved beru82

    (@beru82)


    Hi folks,

    I don’t want to have the pages “Imprint” & “Disclaimer” shown on my website instead I want them to be only in the footer (managed to do that at least!).

    I tried two plugings that are supposed to exclude pages but they didn’t work for me.

    The source code of the header.php looks like this:

    [Code moderated as per the Forum Rules. Please use the pastebin]

    Anybody help?

Viewing 7 replies - 1 through 7 (of 7 total)
  • This topic is marked as “resolved”… yet there is nothing other than the original post (and now, this first comment).

    Further (Google) search turned up a solution: http://gravitationalpull.net/wp/?p=1466

    This solution is good for small nav menus, i.e., no child pages. The cool “Menu” administration in WP’s dashboard does not appear to accommodate child pages.

    I’ve poured through the codex documentation, found the WP 2.0 solution on how to exclude pages from the list: http://codex.wordpress.org/Template_Tags/wp_list_pages

    … but,alas, Twenty Ten does not use the simple wp_list_pages function.

    Any code-savvy samaritan want to chime in with a solution? Is this where the use of filters come into play?

    This topic is marked as “resolved”… yet there is nothing other than the original post

    Unfortunately, if the original poster didn’t see fit to post their solution to their problem,, there’s not a lot we can do.

    Twenty Ten does not use the simple wp_list_pages function

    It uses wp_nav_menu – which in turn falls back to wp_page_menu if no custom menu has been defined. You’ll finds that wp_page_menu has an exclude parameter similar to wp_list_pages.

    Thanks esmi,

    First, I gotta correct myself – the menus subpanel DOES accommodate child pages (drag and drop, like widgets). yay!

    BUT for my current project, it would be great to pass the “exclude page” argument via <?php wp_page_menu(‘exclude=80’ ); ?> (example where page id=80).

    …. I just don’t know where to edit or add the wp_page_menu function.

    Can you provide further guidance?

    You should be able to add this via a function that amends/filters the normal output of wp_page_menu. Something like:

    // Exclude specific pages in wp_page_menu
    if( !function_exists( 'mytheme_page_exclude' ) ) :
    function mytheme_page_exclude( $args ) {
    	$args['exclude'] = '80';
    	return $args;
    }
    endif;
    add_filter( 'wp_page_menu_args', 'mytheme_page_exclude' );

    in functions.php should do it.

    Woo Hoo, it works! I’ve applied my first filter in WordPress!!

    Thank you so much, esmi. I’ll always remember my first.

    lol! From now on, it gets really interesting.

    Glad to have helped. 🙂

    Hi
    same here… would like too fix it inside my header file. Is it possible ? I have include a text in the menu line here
    its inside php <>…
    wp_nav_menu( array( 'exclude=6', 'container_class' => 'menu-header', 'theme_location' => 'primary' ) );

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘How to exclude pages from horizontal navi in twentyten?’ is closed to new replies.