How to exclude pages from a Wordpress navigation bar list
by Ryan on January 4th, 2009 // Filed Under → Wordpress Tips
Have you ever wanted to create pages in WordPress but don’t want them listed in the header or footer navigation areas? You still want the pages to be accessible, perhaps listed in the sidebar, so you don’t want to make them private. You can do this by excluding pages and I’ll show you how to do it.
I have seven pages on this site but only 4, plus the home page, are listed in the header and footer. None of these pages have privacy settings. The remaining three are listed in my sidebar as links rather than in a list of pages. Do you know which ones they are? They are Bookmarks, Friendfeed Lifestream, and RSS Stream.
Pages are displayed with the following code, which is generally used in the header, footer, or sidebar.
<?php wp_list_pages();?>
This will list all of your pages until you add conditions in between ‘()’. You need to use the exclude condition and find out what number ID each page has. The exclude code looks like
<?php wp_list_pages('exclude=17,38' ); ?>
You can see that you have added 'exclude=17,38' to the original
list pages code.
Of course, we need to locate the correct ID numbers for your pages.
Go to Manage > Pages and select the name of the page in which you would like to exclude. In the address bar of your web browser will be a URL that looks like the following.
http://www.yoursite.com/wp-admin/page.php?action=edit&post=96
The number at the end, 96, is the ID number for the page and is the number you will use in the exclude code. You can do this for each page that you want to exclude as long as you put a comma between the page numbers in the code.
Are there other tweaks that you would like to add to your list of pages? Ask me about them in the comments and I will answer your questions. Or if your comment really inspires me I will write an entire article about it ![]()
Article courtesy of kimwoodbridge.com
Read the full article....













Leave a response: