Many navigation bars in WordPress are created dynamically with this piece of code
<?php wp_list_pages();?>
Since it is created dynamically, people often wonder how to exclude certain pages from the navigation. I have a lot more pages than I want listed there and I need a way to remove them.
Here I’m going to list three ways that you can do that. One is a code solution and the other two require the use of a plugin.
I have always attempted to use a code rather than a plugin solution but when there are a lot of pages to exclude or when the site is being created for a client, it may be best to use a plugin. Right now, I have so many pages excluded through the code that it may be easier for me to switch to a plugin in order to manage it. Especially since I have a navigation menu at the top and at the bottom of the page.
Code
Way back I wrote an article about how to exclude pages from the WordPress navigation bar manually. Instead of repeating that information, I have linked to the article. Nothing has changed and the exclude code still works perfectly.
Exclude Pages Plugin
The Exclude Pages Plugin adds a checkbox to the Edit page screen that says “include this page in menus”. When the plugin is installed the checkbox is checked by default. If you want to exclude the page, simply uncheck that checkbox.
pageMash Plugin
The pageMash plugin is the one that I prefer to install on client sites because it has additional functionality. In addition to hiding pages from the navigation bar, this plugin also provides a drag and drop interface that can be used to manage the order in which the pages appear on the navigation bar. It also provides a quick way to edit and rename the pages. Once installed, pageMash will be under the Pages menu.
Do you exclude pages from your navigation bar? Do you use any of these methods? Or do you use a different plugin that you like better?
photo credit: duncan (Wow! No tiaras with an apostrophe and an incorrect spelling of jewelry – gotta love it.)
Ajith Edassery says
The exclude filter in listpages query is still the best option. Too many plugins used for rendering can slow down the blog.. I am still fighting to keep my total number of plugins below 10 :-)
.-= Ajith Edassery´s last blog ..Blog readability test – How readable is your blog? =-.
Ajith Edassery says
By the way, I am writing my new plugin which requires a selected bunch of pages to be excluded from archives, blog menu and feed in one shot :) Any ideas? Hopefully I will launch the plugin by month end and I may need some testing help as well…
.-= Ajith Edassery´s last blog ..Blog readability test – How readable is your blog? =-.
Kim Woodbridge says
Hi Ajith – Under 10? Wow! And LOL – you say you are trying to limit plugins and then add a comment about writing a plugin ;-)
I would like something like pageMash than incorporates Page Links to.
Tracy says
That’s one of the things I love about Thesis (and I’m sure other themes do this, too, just don’t know which ones) – it’s built into the theme to pick and choose which pages to include in your navigation.
I know a lot of folks are sick of Thesis, but I’m still really happy with how easy it makes things like this and creating pages with no sidebar and so on.
.-= Tracy´s last blog ..Who has time to write a long post? =-.
Kim Woodbridge says
Hi Tracy – Some other themes do it too – Headway maybe and other ones but I can’t remember which ones right now.
I’ve never been a big fan of Thesis but I can see why people do like it.
Tracy says
And I can see why other people might not be wild about Thesis! For me it’s great since I don’t have the time to figure out everything I want to do and I can’t afford to pay for help and am loathe to borrow my very wonderful and beautiful friends whenever I need something.
.-= Tracy´s last blog ..Who has time to write a long post? =-.
Mark McLaren says
Hi Kim. I found you through Christine Rondeau @bluelimemedia .
Does pageMash allow you to use link text in navigation that is different than the title you assign to the post/page in the editing interface? For example, on my mcbuzz.com site I have an “About” link in the main nav but the page title is “About McBuzz Communications”.
This is something built in to Thesis and a few other themes. I don’t use Thesis much. So typically I make a page template that has no for the post/page and then put that in manually in the editing window. I would like to have an easier way to do that for my clients.
.-= Mark McLaren´s last blog ..How to Build Your Business in 60 Seconds: Sage Marketing Advice from Mel Pircheski =-.
Kim Woodbridge says
Hi Mark – pageMash doesn’t have that feature – that would be a great addition to the plugin.
Danny Brown says
Great info, Kim.
While Headway has this feature built-in (as do other themes, as other comments have mentioned), it’s not something that’s particularly common, so this is a great resource.
Is there one method you prefer more over the others?
.-= Danny Brown´s last blog ..7 Ways to Market Your Business on Facebook – Free Ebook =-.
Kim Woodbridge says
Hi Danny – I prefer the code method because I’m just nerdy that way. ;-) But, I’ve used pageMash on a lot of client sites and it works great and they don’t have much trouble learning how to use it.
vince jelenic says
Hi, we used the plugin “Menubar”.
uses a superfish jquery dropdown menu system.
pretty easy to manage, simply by your planning which pages are part of which category tree.
You can manage placement, and the top tab of each dropdown can be inactive and named as you wish.
Pretty lightweight overall.
What I love about it is…. you can manage the placement of menus by assigning weights to each page, as well as by category, or with no category at all ..
highly flexible.
And a lot of it is fully automatic.
Add a page to a category (as a subpage) and it show up automatic.
cheers.
vince.
Kim Woodbridge says
Hi Vince – Thanks for the info. Can you also exclude pages with it – if you don’t want a particular page to show up in the navigation bar?
vered - blogger for hire says
I did this a long time ago on Momgrind and of course forgot how to do it. Thanks. :)
.-= vered – blogger for hire´s last blog ..Am I Putting Ideas Into My Kids’ Heads? =-.
Kim Woodbridge says
Hi Vered – I do things like that *all* the time :-)
Dennis Edell | Direct Sales Marketing says
I’ve been using the code, but with my big project at hand, I may want to switch to the plugin; dunno.
So pageMash IS exclude+, that about right?
.-= Dennis Edell | Direct Sales Marketing´s last blog ..It’s His FIRST Comment Contest! =-.
Dennis Edell | Direct Sales Marketing says
It says compatible up to 2.7.1 – ya’ll re using it on these later versions, yes?
.-= Dennis Edell | Direct Sales Marketing´s last blog ..It’s His FIRST Comment Contest! =-.
Kim Woodbridge says
Hi Dennis – It does work with the current version. I haven’t tested it with 3.0 yet.
Arafat Hossain Piyada says
I have too many pages and I won’t willing to put each one on my top navigation bar but for me code work better as I don’t want to install to many plugin.
.-= Arafat Hossain Piyada´s last blog ..Laptop Lilo keep you safe while you use laptop =-.
Kim Woodbridge says
Hi Arafat – I’m still using the code too – but the list of pages I’m excluding has become very long :-)
Colleen says
Because we are not coders, the Exclude Pages Plugin seems to be the best bet for us.
.-= Colleen´s last blog ..Utter Disappointment And The Classiest Acts That Followed, Armando Galarraga, Detroit Tigers, Jim Joyce =-.
Kim Woodbridge says
Hi Colleen – I haven’t used that one so it’s good to know that you aren’t having any problems with it.
Neil says
I’ve been using Page Lists Plus plugin on most projects, but I think I ‘m going to switch to pagemash, I think the user interface is awesome! It’s so much easier to have the page order and visibility in one place. GREAT FIND, and thanks for sharing!
Kim Woodbridge says
Hi Neil – I’m not familiar with Page Lists Plus. I haven’t had any issues with PageMash so I think it’s a good one to use.
Thanks
rangga says
hi kim..
thanks for the tips, i think im gonna try pageMash Plugin
rangga says
back again..
pageMash Plugin doesnt work on me kim,i cant figur it out why, so i check your exclude code, the code on the article doesnt work either, until i saw your code on comment that look something like this
and it work fine, thanks again.. you rock..!!
Kim Woodbridge says
Hi – I rarely have trouble with pagemash – it may be conflicting with another plugin.
I’m glad you got it working.