hello all
I want to create some pages in wordpress, but I dont like these pages visible in menus. How can I create such pages ?
thanks
hello all
I want to create some pages in wordpress, but I dont like these pages visible in menus. How can I create such pages ?
thanks
This is usually dependent on your theme I think...
If I'm not wrong, some themes will have an option on the "Theme Options" page. If the option isn't there, the author of the theme you're using hasn't provided it, so you'll need to either recode the theme or switch to a different one.
Use something like Exclude Pages « WordPress Plugins or work with Function Reference/wp list pages « WordPress Codex to exclude a page
If you're using/creating a custom theme or don't mind extending the one you're using, you could explicitly specify which page names or ids you want to be in the menu by editing the links. In my custom theme I just went in and destroyed the dynamically-generated links, replacing them with my own.
I chose to do this in one of my own projects because I wanted to be able to have a lot of non-navigation pages without having to keep adding to exclude_pages.
EDIT (to be more specific):
Navigation in the default theme (wp-content/themes/twentyten) is in the header.php file and looks like this:
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
If you view-source on the page this generates in a default WordPress install, it becomes the following html:
<div id="access" role="navigation">
<div class="skip-link screen-reader-text"><a href="#content" title="Skip to content">Skip to content</a></div>
<div class="menu">
<ul>
<li class="current_page_item"><a href="http://YOURSITE.COM/" title="Home">Home</a></li>
<li class="page_item page-item-2"><a href="http://YOURSITE.COM?page_id=2" title="About">About</a></li>
</ul>
</div>
</div><!-- #access -->
So, as you can see, if you wanted to customize the navigation you would just remove that wp_nav_menu line and replace it with the appropriate html. Say you want your navigation to go to the Home, Cool Stuff and About Us pages. That could accomplished with the following code in header.php:
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our CUSTOM navigation menu. */ ?>
<div class="menu">
<ul>
<li class="<?php if (!is_paged() && is_home()) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>" title="Home">Home</a></li>
<li class="<?php if (is_page('cool-stuff')) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>/cool-stuff" title="Cool Stuff">Cool Stuff</a></li>
<li class="<?php if (is_page('about-us')) { ?>current_page_item<?php } else { ?>page_item<?php } ?>"><a href="<?php bloginfo('url'); ?>/about-us" title="About Us">About Us</a></li>
</ul>
</div>
</div><!-- #access -->