ThemeShaper Forums » Thematic

[closed]

Remove static page from menu

(9 posts)
  • Started 4 years ago by paulg
  • Latest reply from louisJ
  • This topic is not resolved
  1. paulg
    Member

    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

    Posted 4 years ago #
  2. amygail
    Member

    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

    Posted 4 years ago #
  3. amygail
    Member

    to exclude multiple pages you'd

    'exclude' => '147,5',

    etc

    Posted 4 years ago #
  4. paulg
    Member

    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

    Posted 4 years ago #
  5. paulg
    Member

    I meant to say the whole site disappears. Typing too fast.

    Posted 4 years ago #
  6. paulg
    Member

    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

    Posted 4 years ago #
  7. 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!

    Posted 4 years ago #
  8. @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!

    Posted 4 years ago #
  9. louisJ
    Member

    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

    Posted 3 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.