Hide WordPress Pages from the Navigation Menu

Having recently purchased an iPhone 3G, I’ve installed on my blog site WPtouch. WPtouch is a plug-in that transforms your blog into an application-style theme when you browse to your site using your iPhone. However, to get the tag cloud and monthly archive list to appear, you must have an Archives page, which is based on the Archive template. This is accomplished relatively easily, and works really well on the iPhone, but leaves me with an empty page on my site when browsing using a standard PC and my default theme. By supplying the page ID to the Exclude prompt of the pages widget it removed the Archives page entry from the right-hand column, but I still had the Archive link at the top of my site, the navigation menu.

So how can I remove the Archives page from the navigation menu, but leave the code intact so that the other page links function and appear as normal? Well, that’s a little tricky, but here’s how:

  1. In the WordPress theme editor, open up the header.php file and find the following line:
    <?php wp_list_pages('title_li=&depth=1'); ?>
  2. Enter &exclude= near the end of the line, but inside the brackets. The code should look like this:
    <?php wp_list_pages('title_li=&depth=1&exclude='); ?>
  3. Now, all you have to do is add the page ID number or numbers that you want to hide after the &exclude=. If more than one page needs hiding, make sure you separate the page ID’s with commas. In my case, the Archives page has an ID of 173, so my code looks like this:
    <?php wp_list_pages('title_li=&depth=1&exclude=173'); ?>


  1. Great site this blog.grapii.com and I am really pleased to see you have what I am actually looking for here and this this post is exactly what I am interested in. I shall be pleased to become a regular visitor :)

  2. it looks explained very good, but my header.php does not contain the list pages tag…can’t find it anywhere and not very good with this kind of stuff, I have to admit

  3. Looks like you’re using the iNove theme by mg12. If that’s the case, you’ll find in your header.php file a include reference to the templates/header.php file. Open this file and you’ll see the entry for wp_list_pages.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>