Quantcast
Channel: Grapii » WordPress
Viewing all articles
Browse latest Browse all 11

Hide WordPress Pages from the Navigation Menu

$
0
0

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'); ?>

Viewing all articles
Browse latest Browse all 11

Trending Articles