Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>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.</p> <p>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.</p> <p>EDIT (to be more specific):</p> <p>Navigation in the default theme (wp-content/themes/twentyten) is in the header.php file and looks like this:</p> <pre><code>&lt;div id="access" role="navigation"&gt; &lt;?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?&gt; &lt;div class="skip-link screen-reader-text"&gt;&lt;a href="#content" title="&lt;?php esc_attr_e( 'Skip to content', 'twentyten' ); ?&gt;"&gt;&lt;?php _e( 'Skip to content', 'twentyten' ); ?&gt;&lt;/a&gt;&lt;/div&gt; &lt;?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. */ ?&gt; &lt;?php wp_nav_menu( array( 'container_class' =&gt; 'menu-header', 'theme_location' =&gt; 'primary' ) ); ?&gt; &lt;/div&gt;&lt;!-- #access --&gt; </code></pre> <p>If you view-source on the page this generates in a default WordPress install, it becomes the following html:</p> <pre><code>&lt;div id="access" role="navigation"&gt; &lt;div class="skip-link screen-reader-text"&gt;&lt;a href="#content" title="Skip to content"&gt;Skip to content&lt;/a&gt;&lt;/div&gt; &lt;div class="menu"&gt; &lt;ul&gt; &lt;li class="current_page_item"&gt;&lt;a href="http://YOURSITE.COM/" title="Home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li class="page_item page-item-2"&gt;&lt;a href="http://YOURSITE.COM?page_id=2" title="About"&gt;About&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- #access --&gt; </code></pre> <p>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:</p> <pre><code>&lt;div id="access" role="navigation"&gt; &lt;?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?&gt; &lt;div class="skip-link screen-reader-text"&gt;&lt;a href="#content" title="&lt;?php esc_attr_e( 'Skip to content', 'twentyten' ); ?&gt;"&gt;&lt;?php _e( 'Skip to content', 'twentyten' ); ?&gt;&lt;/a&gt;&lt;/div&gt; &lt;?php /* Our CUSTOM navigation menu. */ ?&gt; &lt;div class="menu"&gt; &lt;ul&gt; &lt;li class="&lt;?php if (!is_paged() &amp;&amp; is_home()) { ?&gt;current_page_item&lt;?php } else { ?&gt;page_item&lt;?php } ?&gt;"&gt;&lt;a href="&lt;?php bloginfo('url'); ?&gt;" title="Home"&gt;Home&lt;/a&gt;&lt;/li&gt; &lt;li class="&lt;?php if (is_page('cool-stuff')) { ?&gt;current_page_item&lt;?php } else { ?&gt;page_item&lt;?php } ?&gt;"&gt;&lt;a href="&lt;?php bloginfo('url'); ?&gt;/cool-stuff" title="Cool Stuff"&gt;Cool Stuff&lt;/a&gt;&lt;/li&gt; &lt;li class="&lt;?php if (is_page('about-us')) { ?&gt;current_page_item&lt;?php } else { ?&gt;page_item&lt;?php } ?&gt;"&gt;&lt;a href="&lt;?php bloginfo('url'); ?&gt;/about-us" title="About Us"&gt;About Us&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt;&lt;!-- #access --&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload