How To Hide Pages from Showing Up In Your Main Menu
ADVERTISEMENTSHave you ever been in a situation where you didn’t want certain pages in your WordPress blog from showing up in the main menu? By default all pages and sub-pages you create will automatically display in your menu.
To remove certain pages, find the wp_list_pages() template tag in your blog’s theme and customize it to display the menu the way you want it. The tag can be found mostly in your theme’s header.php or sidebar.php.
This is how I use the template tag on my blog’s theme:
In the above code,
exclude is used to hide Pages with IDs of 561, 587, 590, 491 and 650 from the list. Please note that excluding a Page will also exclude all of its sub-pages from the list.
sort_column=menu_order is used to list the Pages in the order defined by the Page Order settings
depth=1 is used to show only the top level Pages and
title_li= is used to prevent displaying the default heading text above the list
For more info on this template tag, check this WordPress page.
Search JohnTP.com or view a random post
Related Articles
Find out what I am doing currently by .
Posted on September 13th, 2007 | Category: WordPress |
Salman Siddiqui
September 14, 2007 at 5:03 am
that is just what I was looking for..
great tip..
and hey a great design too. I recently shifted to wordpress from blogger and I am also planning a redesign. Could you please tell me if read something extra considering that i know css html and little of php. To create the logo and all do I need to be very good at photoshop. That is the only thing I haven’t given my time too…
Nirmal
September 14, 2007 at 10:37 am
This is a good way, But What I do is to add the link manually instead of calling the function.
Marc
September 14, 2007 at 10:50 am
Thanks for the good tip.
I have customized my menu already.
Beta3
September 14, 2007 at 6:46 pm
What about just making the page private?? Thats easier right?
Madhur Kapoor
September 14, 2007 at 9:05 pm
Cool tip John , i have been looking for something like this .
Get A Six Pack
October 1, 2007 at 3:25 am
Great tip, thanks.. I’m just trying that now
Karen Zara
October 4, 2007 at 1:05 am
Thank you for sharing this tip. I’m going to try it on some of my self-hosted WP blogs.
Wogan May
February 4, 2008 at 8:32 am
Thanks for the great tip - you were the first hit on Google And it was exactly what I needed.
~ Wogan