Hello,
I need to remove specific static pages from my menu. These are pages I want to be accessible through internal and external links but not appear in the menu. Any ideas?
PaulG
Hello,
I need to remove specific static pages from my menu. These are pages I want to be accessible through internal and external links but not appear in the menu. Any ideas?
PaulG
this is how I do it
function childtheme_menu_args($args) {
$args = array(
'sort_column' => 'menu_order',
'exclude' => '147',
'menu_class' => 'menu',
'echo' => true
);
return $args;
}
add_filter('wp_page_menu_args','childtheme_menu_args');
Add this to your (child)theme's functions.php &
change the 'exclude' number to your page id
to exclude multiple pages you'd
'exclude' => '147,5',
etc
Thanks for the quick reply amygail. However, pasting this code (and inserting the proper page IDs) renders a blank page. The who site disappears.
Any suggestions?
Paul
I meant to say the whole site disappears. Typing too fast.
I think I have this figured out. There was a conflict with code already in my functions.php. When I commented out the previous code, your solution worked as expected.
Thanks for your help.
PaulG
paulg, if you plan on creating new pages and having to customize the menu a bit often, instead of editing the functions.php file, I would recommend a great plugin called Pages List Plus.
I've tested many other plugins for doing those things and I ended up with this great one.
It's very powerful and let you set lots of options through the admin "edit page". You can set it not to appear on the menu, you can use it to add outbound links to the menu, add custom classes to the pages, etc.
Worth checking!
@amygail, your suggestion is great. That is the best way to do it for child themes.
@theorib, the Pages List Plus plugin is only for wp_list_pages. Thematic uses the new wp_page_menu. I don't know how to full use it yet as there isn't enough writeup on it, but they are different animals.
I would say this issue is resolved because I had the same issue and fixed my problem.
If you're getting a blank page, it could be faulty PHP. I discovered that leaving blank space inside of <?php ?> when it's not needed can cause errors!
Hi I am trying to hide a page in the access, but this trick doesn't work for me.
Any idea?
thanks
edit: I found the plugin Exclude pages, which works great for this
This topic has been closed to new replies.