How To Hide Individual Page In WordPress Blog

Posted by

Hi,

In many cases we need to hide the page from the menu or on the list.  This should be the code for the menu in your theme:

<?php wp_list_pages(‘sort_column=menu_order&depth=1&title_li=’);?>

If you have created a page but do not want to display it in blog menu then you need to add an exclude command and the page number to your existing code. Page umber can be found on Manage -> Pages from wordpress admin area. Here is the sample code if I was excluding page 8:

<?php wp_list_pages(‘depth=1&sort_column=menu_order&exclude=8&title_li=’ . __(”) . ” ); ?>

If you wantr to exclude more than one page then do it by simply adding a comma between each page number:

<?php wp_list_pages(‘depth=1&sort_column=menu_order&exclude=8,17&title_li=’ . __(”) . ” ); ?>

This code will exclude 8 and 17 pages from the blog page menu.

That’s it!

Thanks,

Shane G.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.