Two hacks about WordPress
July 26th, 2007 Computing- To exclude page links in the navigation bar in the header.
I have some pages that I want them to be accessible by the public but not listed in the navigation bar. After some search, I found this effective yet simple solution. What I did is to edit theheader.phpfile in the current theme folder. Locate the functionwp_list_pagesand addexclude=pageID#,pageID#to its arguments, wherepageID#s are the ID numbers of the pages to be hidden. Here is an example:<?php wp_list_pages('exclude=123&sort_column=menu_order&depth=1&title_li='); ?>where
123is the ID of the page to be hidden.UPDATE: Just found a nice plugin, Page Link Manager, that does the same job in a much neater manner. Besides the option page, an “Include Page in Site Navigation” checkbox will be available when a page is being edited.
- To exclude pages from the Extended Live Archive.
I just installed this plugin to display the blog archives. It works very well in a very neat and intuitive way. But I found that it also includes pages by default and I couldn’t find the option to disable it. So I searched again and found a solution in their Flickr forum. What should be edited are two files in the plugin folder:af-extended-live-archive.phpandaf-extended-live-archive-include.php.
In these two files, locate the following two expressions in both filespost_status = 'publish'
p.post_status = 'publish'
then change them to
post_status = 'publish' AND post_type='post'
p.post_status = 'publish' AND p.post_type='post'
respectively. That’s it. Now ELA displays posts only.
Related Posts
- Integrate Gallery and WordPress
- Long weekend
- Wordpress and .htaccess problem
- WordPress database backup and restore
- Feed aggregation in WordPress
Trackback URI | RSS feed for comments on this post

Recent Comments