Tuesday, July 21, 2009

How to Exclude Pages from the WordPress Navigation Bar

Go your wp-admin panel > Appearance > Editor
A list of files relating to your current themes (template) is on the right.
Click on Head (header.php)
In the editor box, find this line <?php wp_list_pages();?>

This will list all of your pages until you add conditions in between ( ).
Find out what number ID each page has. The exclude code looks like

<?php wp_list_pages('exclude=17,38' ); ?>

This means you want to exclude page id 17 and 38.

To locate the correct ID numbers for your pages:

Go to Pages > Edit and hover your mouse over the title of a page, you'll see the url at the bottom of your browser or click on the your page to edit, you'll see the url in the address bar of your browser, something like

http://www.yoursite.com/wp-admin/page.php?action=edit&post=96

The number at the end, ie: 96, is the ID number for the page. Add that number to your 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.

No comments:

Post a Comment