Wordpress - How To Exclude Some Pages - list_pages

If you want to exclude some pages from displaying, use the function ‘wp_list_pages”. The PHP files to call this function can vary depending on your template, but usually they are invoked either in ‘header.php’ or ’sidebar.php’ (’rsidebar.php or ‘lsidebar.php’).

Just specify what pages to include or exclude as in the following examples:

wp_list_pages(’title_li=Pages&include=2,4,6,8′ );

or

wp_list_pages(’title_li=Pages&exclude=2,4,6,8′ );

How to find the page ID

Log in to your WordPress admin interface and go to Manage -> Pages. Click on the page that you want to include or exclude. In the URL bar of the browser, the last part is the page ID.

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

No Comments

Leave a comment