Support » Fixing WordPress » Create new pages but not have them linked to in the menu

  • Resolved Andy



    I want to create new pages but not have them appear in the usual list of links in the main menu. I want to link to them seperately.

    I’m sure there must be a simple way of doing this?


Viewing 14 replies - 1 through 14 (of 14 total)
  • I presume your menu is in your header?

    If so, go to header.php and find something like:

    ‘<?php wp_list_pages(); ?>’

    To exclude pages, just add their ID to the exclude, like this:

    ‘<?php wp_list_pages(‘exclude=2,3′); ?>’

    I hope that helps,
    ~Shane Hudson

    Moderator Mark Ratledge


    Forum Moderator

    Or, might be easier to use an plugin like Exclude Pages « WordPress Plugins to exclude a page from navigation rather then tweak wp_list_pages.



    Hi, thanks for the info, seems good but i have nothing like that in my header, see:

    * The Header for our theme.
    * Displays all of the <head> section and everything up till <div id=”main”>
    * @package WordPress
    * @subpackage Twenty Ten
    * @since 3.0.0

    <!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    	<meta charset="<?php bloginfo( 'charset' ); ?>" />
    	// Returns the title based on the type of page being viewed
    		if ( is_single() ) {
    			single_post_title(); echo ' | '; bloginfo( 'name' );
    		} elseif ( is_home() || is_front_page() ) {
    			bloginfo( 'name' ); echo ' | '; bloginfo( 'description' ); twentyten_the_page_number();
    		} elseif ( is_page() ) {
    			single_post_title( '' ); echo ' | '; bloginfo( 'name' );
    		} elseif ( is_search() ) {
    			printf( __( 'Search results for "%s"', 'twentyten' ), esc_html( $s ) ); twentyten_the_page_number(); echo ' | '; bloginfo( 'name' );
    		} elseif ( is_404() ) {
    			_e( 'Not Found', 'twentyten' ); echo ' | '; bloginfo( 'name' );
    		} else {
    			wp_title( '' ); echo ' | '; bloginfo( 'name' ); twentyten_the_page_number();
    	<link rel="profile" href="" />
    	<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    	<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    	<?php wp_head(); ?>
    <body <?php body_class(); ?>>
    <div id="wrapper" class="hfeed">
    <div id="header">
    <div id="masthead">
    <div id="branding" align="center" onclick="location.href='';" style="cursor:pointer;">
    <h9 class="test">Personal Trainer, Life Coach <br />
    	& Blog Author</h9>
    </div><!-- #branding -->
    <div id="access">
    <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
    <?php wp_nav_menu( array( 'sort_column' => 'menu_order', 'container_class' => 'menu-header' ) ); ?>
    </div><!-- #access -->
    </div><!-- #masthead -->
    </div><!-- #header -->
    <div id="main">

    Any ideas?



    Ah, installed the plugin. Awesome.

    Thanks to all 🙂

    Moderator Mark Ratledge


    Forum Moderator

    Good that it worked….

    Hey, the plugins didn’t worked for me but I have the same question.

    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!).

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

    * The Header for our theme.
    * Displays all of the <head> section and everything up till <div id=”main”>
    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0
    ?><!DOCTYPE html>
    <html <?php language_attributes(); ?>>
    <meta charset=”<?php bloginfo( ‘charset’ ); ?>” />
    * Print the <title> tag based on what is being viewed.
    * We filter the output of wp_title() a bit — see
    * twentyten_filter_wp_title() in functions.php.
    wp_title( ‘|’, true, ‘right’ );

    <link rel=”profile” href=”″ />
    <link rel=”stylesheet” type=”text/css” media=”all” href=”<?php bloginfo( ‘stylesheet_url’ ); ?>” />
    <link rel=”pingback” href=”<?php bloginfo( ‘pingback_url’ ); ?>” />
    /* We add some JavaScript to pages with the comment form
    * to support sites with threaded comments (when in use).
    if ( is_singular() && get_option( ‘thread_comments’ ) )
    wp_enqueue_script( ‘comment-reply’ );

    /* Always have wp_head() just before the closing </head>
    * tag of your theme, or you will break many plugins, which
    * generally use this hook to add elements to <head> such
    * as styles, scripts, and meta tags.

    <body <?php body_class(); ?>>
    <div id=”wrapper” class=”hfeed”>
    <div id=”header”>
    <div id=”masthead”>
    <div id=”branding” role=”banner”>
    <?php $heading_tag = ( is_home() || is_front_page() ) ? ‘h1’ : ‘div’; ?>
    <<?php echo $heading_tag; ?> id=”site-title”>
    ” title=”<?php echo esc_attr( get_bloginfo( ‘name’, ‘display’ ) ); ?>” rel=”home”><?php bloginfo( ‘name’ ); ?>
    </<?php echo $heading_tag; ?>>
    <div id=”site-description”><?php bloginfo( ‘description’ ); ?></div>

    // Check if this is a post or page, if it has a thumbnail, and if it’s a big one
    if ( is_singular() &&
    has_post_thumbnail( $post->ID ) &&
    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘post-thumbnail’ ) ) &&
    $image[1] >= HEADER_IMAGE_WIDTH ) :
    // Houston, we have a new header image!
    echo get_the_post_thumbnail( $post->ID, ‘post-thumbnail’ );
    else : ?>
    <img src=”<?php header_image(); ?>” width=”<?php echo HEADER_IMAGE_WIDTH; ?>” height=”<?php echo HEADER_IMAGE_HEIGHT; ?>” alt=”” />
    <?php endif; ?>
    </div><!– #branding –>

    <div id=”access” role=”navigation”>
    <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
    <div class=”skip-link screen-reader-text”>“><?php _e( ‘Skip to content’, ‘twentyten’ ); ?></div>
    <?php /* Our navigation menu. If one isn’t filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
    <?php wp_nav_menu( array( ‘container_class’ => ‘menu-header’, ‘theme_location’ => ‘primary’ ) ); ?>
    </div><!– #access –>
    </div><!– #masthead –>
    </div><!– #header –>

    <div id=”main”>

    Anybody help?

    Try doing it via css
    .page-item-92{ display:none; }

    “92” means the page-id of the page

    Hope that helps someone.

    That’s helped me, thanks fedmich. I’ve made a child theme of twentyten and would like to exclude some pages from the main nav bar. The css works, but is there a way with php? With twentyten the wp_list_pages (‘exclude=5’ ) doesn’t seem possible! I’ve looked in the header and functions but can’t work out a way to do it. Does anybody have any ideas?

    You’re welcome.

    did you added the code on the header.php on the child themme folder?
    it should work as I’ve done it before, and it worked.

    No, as I’m not sure where to put the code in the child theme header or what exact code to add – twentyten is quite different. Any guidance greatly appreciated. Thanks

    I tried to use the code
    .page-item-92{ display:none; }
    you suggested, via CSS, but… I don’t know where to insert it!
    Where should I?

    The item I was trying to is this one:

    #navbar,.navbar {
    border-bottom:1px solid #000;
    font-family:Helvetica, Arial, Trebuchet MS, Verdana;
    margin:0 auto 5px;

    And this is why, after all this, I wrote:

    .page_item 4 {

    But it doesn’t work.

    Can you give the link where the site is so I could investigate more?

    .page_item 4 {

    I noticed on your code its a .page_item”<space>”4
    it should be dash
    .page-item-4{ display:none; }

    you can put that on style.css or as inline on your header.php
    <style>.page-item-4{ display:none; }</style>


    Now it worked!!!
    Thank you very much indeed, my unkown webmaster.

    You’re welcome 🙂

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘Create new pages but not have them linked to in the menu’ is closed to new replies.