Wordpress is clearly the go-to open-source blogging software (and some would say content management system) for the Web entrepreneur and affiliate marketers. Despite its active support community and broad extensibility, new installations often require some tweaking.
One of the main issues many have is what to do when they have too many pages in their navigation menu. Let's look at two ways to exclude pages and customize a WordPress navigation menu.
The Coding Way
The first way to exclude pages is to do hack the source code a little. If you are comforable making some adjustments to PHP files, go to the theme editor under "Presentation" and select header.php. From here, look for the wp_list_pagse() tag - it often looks like this <?php wp_list_pages('title_li=&depth=-1);?>. To exclude pages, simply add the (=&exclude= 1,2,3) (without the paranthesis) wherein the numbers represent the page IDs you want to hide from the navigation menu. For example, the whole string would look like the following:
- <?php wp_list_pages(’title_li=&depth=-1=&exclude= 1,2,3‘); ?>
The one problem with this method is that you need to exclude pages each time you create them. Is there a better way? Why, yes, of course!
The Plugin Way
As has been said over and over before, the real beauty of WordPress is the extensibility. Thousands of available plugins give you the ability to add some unique functionality without having to know how to code. If you don't wan't to have to exclude pages manually, there is a way - the plugin way.
The Exclude Pages WordPress Plugin by Simon Wheatley enables bloggers to hide pages in a WordPress blog. This plugin adds a checkbox, “include this page in menus”, which is checked by default. If you uncheck it, the page will not appear in any listings of pages (which includes, and is usually limited to, your page navigation menus). Pages which are children of excluded pages also do not show up in menu listings. (An alert in the editing screen, underneath the "include" checkbox allows you to track down which ancestor page is affecting child pages in this way.)
Do you know of other page exclusion methods or plugins?
Share them with other readers of Website Magazine by commenting below.