WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Need to hide a page from the TwentyTen menu (4 posts)

  1. jb2cool
    Member
    Posted 3 years ago #

    First of all please excuse my ignorance of WordPress. I'm a very new user and chose it due to it's plugin nature. It's not turning out quite as easy as i'd hoped though.

    My WordPress powered site is pretty basic. I'm using the default TwentyTen theme and not really doing anything fancy. I do have 1 small issue though in that i want to hide one of my published pages from the menu. It's a holding page for NextGEN/LightBox Plus and parses info between the 2. I've changed the visibility to Private but that then breaks NextGEN/LightBox Plus.

    This is the page;
    http://jb2cool.com/?page_id=364

    And as you can see, it doesn't really do anything on it's own so i don't want it shown in the menu structure (It shows up as 'Gallery' if you wanted to take a look.

    I've found that wp_list_pages should have the exclude functionality that i need but not really sure how to implement this.

    Thanks in advance

  2. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    Your best bet is to create a custom menu, and include only the Pages you want to have appear in your menu.

    From your dashboard, go to Appearance -> Menus

    From here, you can create a custom menu, and then assign that menu to the header menu location.

  3. Chip Bennett
    Theme Review Admin
    Posted 3 years ago #

    However, if you do want to attempt to customize wp_page_menu() (which is what wp_nav_menu() falls back to in TwentyTen, doing so is easy enough.

    CAVEAT: DO NOT MODIFY TWENTYTEN DIRECTLY. If you want to make changes to the template, create a Child Theme, and make changes only to the Child Theme.

    To exclude Page with ID=364 from wp_page_menu(), add the following argument:

    'exclude'      => '364'

    You can follow TwentyTen's example, and add something like the following to your (Child Theme's) functions.php file (note: untested, but should work):

    function my_child_theme_page_menu_args( $args ) {
    	$args['exclude'] = '364';
    	return $args;
    }
    add_filter( 'wp_page_menu_args', 'my_child_theme_page_menu_args' );
  4. jb2cool
    Member
    Posted 3 years ago #

    Thanks Chip,
    I followed your first post and simply made a custom menu. Much easier. I didn't realise that i could make nested menus in that but worked out that you just have to stagger the pages to make them nest.

    Much appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic