ThemeShaper Forums » Thematic

[closed]

Adding pages without adding page tabs

(8 posts)
  • Started 10 years ago by engineeryourface
  • Latest reply from patrick
  • This topic is resolved
  1. Hi!

    Is it possible to add pages without adding a corresponding page tab to the navigation bar?

    I would like to link to some pages on my site via text links and don't want them to be directly accessible.

    http://www.engineeryourface.com

    As an example, I have a photo album linked from my photos tab, but as it is you can reach it from anywhere on the site.

    I appreciate any and all help :)

    Posted 10 years ago #
  2. I found a solution using the following plug-in:

    http://wordpress.org/extend/plugins/exclude-pages/

    Posted 10 years ago #
  3. patrick
    Member

    Hi,

    If you do not want to use a plugin, which imo is better, you can add this to your function.php file :

    function my_menu_args($args) {
        $args = array(
            'exclude' => 21,
            'echo' => true
        );
    	return $args;
    }
    add_filter('wp_page_menu_args','my_menu_args');

    Replace 21 by the id of the page you want to remove from the menu. If you want to remove more than 1 page:

    exclude => '21,22,23',

    Make sure you are not already using this filter, to show a home link to the menu for example. If you are, you can insert the exclude line in your function just before the echo line and you're done.

    P.

    Posted 10 years ago #
  4. Hmmm, it does indeed hide the page but it also shifts the tabs all the way to the left and reverses the order. I must have something else in my functions.php causing this although nothing that starts with function my_menu_args.

    Posted 10 years ago #
  5. patrick
    Member

    my_menu_args is the name I arbitrary choose for this function, you may have a different name for it. It is better to search for wp_page_menu_args.

    ---edit
    Try adding those 2 lines of code before the exclude line :

    'sort_column' => 'menu_order',
      'menu_class' => 'menu',

    ---edit

    P.

    Posted 10 years ago #
  6. It's working for every page now except the videos page (also the home page) now. Hmmm....

    Posted 10 years ago #
  7. yikes nevermind!

    I logged out and logged back in and it corrected itself, the code works perfectly

    Posted 10 years ago #
  8. patrick
    Member

    Glad to hear !

    P.

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.