1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Remove Page From Wordpress Menu

Discussion in 'WordPress' started by sidious1990, May 28, 2009.

  1. #1
    In wordpress, when I create a page, it automatically puts a link to it in the menu of the site.

    Is there anyway to stop wordpress automatically creating these links?
    SEMrush
     
    sidious1990, May 28, 2009 IP
    SEMrush
  2. myp

    myp Well-Known Member

    Messages:
    1,281
    Likes Received:
    71
    Best Answers:
    0
    Trophy Points:
    140
    #2
    It is actually your theme that is creating these links. Anyway, go to your themes folder (wp-content/themes/themename/) and open up the header.php file. In it you will find a line that says wp_list_pages('parameters') [it won't actually say parameters, thats just where they are] All you have to do is go to the end of the parameters and add "&exclude=p1,p2" replacing p1 and p2 with the id numbers of the pages that you don't want to show in the menu. To add more just add another comma and then the number.

    If you create a lot of pages and don't want any of them added it might just be easier to get rid of the whole wp_list_pages line altogether and instead just create hardlinks to the pages that you do want in the menu.

    Let me know if you need any clarification on this...
     
    myp, May 28, 2009 IP
  3. sidious1990

    sidious1990 Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Is the line that your talking about?:

    <?php wp_list_pages('title_li=&depth=-1'); ?>

    If so where exactly do I place the code you mentioned?


    Thanks,
     
    sidious1990, May 28, 2009 IP
  4. sidious1990

    sidious1990 Peon

    Messages:
    99
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Nevermind done it now, thanks for the help
     
    sidious1990, May 28, 2009 IP
  5. Voya

    Voya Member

    Messages:
    61
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    45
    #5
    I think you should have that option in the widget section (EXCLUDE PAGE by id...)
     
    Voya, May 28, 2009 IP
  6. Jalpari

    Jalpari Notable Member

    Messages:
    5,640
    Likes Received:
    137
    Best Answers:
    0
    Trophy Points:
    260
    #6
    Edit ur theme header.php or sidebar.php (depends where theme is pulling pages list) and find this line <?php wp_list_pages; ?> just remove also remove CSS of list pages but be carefull in removing list pages.
     
    Jalpari, May 29, 2009 IP
  7. jsruok

    jsruok Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    for that purpose:
    http://wordpress.org/extend/plugins/exclude-pages/
     
    jsruok, Nov 26, 2009 IP
  8. Wp-Mod.Com

    Wp-Mod.Com Peon

    Messages:
    381
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    0
    #8
    try opening your header.php and search for this function wp_list_pages there will be a code like this

      <?php wp_list_pages([COLOR="Red"]'sort_column=menu_order&title_li='[/COLOR]); ?>
    Code (markup):
    the text in red can be anything not necessary

    just add this

    &exclude=[COLOR="Red"]17,38[/COLOR]
    Code (markup):
    the nos. will be page no. which you want to exclude

    so your final code will be like this

     <?php wp_list_pages('sort_column=menu_order&title_li=&exclude=17,38' ); ?>
    Code (markup):
    where all the pages you want to exclude , page nos should be added


    if you still have problems please comment , hope i am helpful
     
    Wp-Mod.Com, Nov 26, 2009 IP
  9. Dean_Saliba

    Dean_Saliba Well-Known Member

    Messages:
    1,180
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    170
    #9
    Dean_Saliba, Nov 26, 2009 IP
  10. yurolex

    yurolex Peon

    Messages:
    1
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #10
    Can you help me with the same issue? I don't want some wordpress pages in menu, because I created graphical buttons in header for them. Unfortunately, I am a better designer than the coder. I tried to use all above mentioned recommendations, but I failed. Here is the code of my home.php and index.php template files:
    <?php get_header(); ?>
    <?php query_posts('post_type=page&orderby=menu_order&order=asc&exclude=10'); ?>
    
    <div id="page">
    	<div id="slider">
    		<ul class="navigation">
    <?php while (have_posts()) : the_post(); ?>
    			<li><a href="#<?php echo $post->post_name ; ?>"><span><?php the_title(); ?></span></a></li>
    <?php endwhile;?>
    		</ul>
    
    		<div class="scrollButtons scrollMeLeft"><a><span>previous</span></a></div>
    
    		<div class="scroll">
    			<div class="scrollContainer">
    <?php while (have_posts()) : the_post(); ?>
    				<div class="panel" id="<?php echo $post->post_name ; ?>">
    					<h3></h3>
    					<?php the_content(); ?>
    				</div>
    <?php endwhile;?>
    			</div>
    		</div>
    
    		<div class="scrollButtons scrollMeRight"><a><span>next</span></a></div>
    
    	</div>
    </div>
    
    <?php get_footer(); ?>
    PHP:
     
    yurolex, Dec 9, 2009 IP
  11. bodders71

    bodders71 Peon

    Messages:
    45
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #11
    That's a fantastic resource. You just saved me a major headache. Thanks a lot!
     
    Last edited: May 14, 2011
    bodders71, May 14, 2011 IP
  12. Dywaz

    Dywaz Active Member

    Messages:
    167
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #12
    I has same problem :) For me help Exclude Pages plugin. It simple add "Include this page in lists of pages" check box.
     
    Dywaz, Feb 13, 2012 IP
  13. niche chick

    niche chick Peon

    Messages:
    11
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #13
    The front page manager is an easy plugin to use, if you don't want to bother with coding.
     
    niche chick, Mar 11, 2012 IP