Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Where is navigation set in WordPress

Posted on 2011-10-01
7
Medium Priority
?
230 Views
Last Modified: 2012-06-27
Hello Experts - I am new to Wordpress, and know less about php, and am unclear about how to set the main navigation - I added a page which has a parent of one of the top level pages, but now its title is showing up in the main navigation. I'm not seeing where to remove this - can you help?

Thanks  
Steve
0
Comment
Question by:tablaFreak
  • 4
  • 3
7 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36897136
It is theme dependent.  A good WordPress theme has an area for navigation defined in the header.php file.  This area checks to see if you have a custom menu defined (Appearance | Menus) and if so, it uses that menu.  If no menu is defined, a really well-developed theme will use a function to output a list of pages so that there is some form of navigation present. There are also themes that come with their own menu builders but this is getting rarer as the custom menu feature in the core improves.

So my guess is that you have a pretty good theme where it is looking for a custom menu and not finding one, so it is defaulting to all pages. Define a custom menu and see if it overwrites.  
0
 

Author Comment

by:tablaFreak
ID: 36897196
Hi Jason - Thanks for that, I found this call in home.php:

<?php wp_list_pages('title_li=&exclude=38,103,82,104,121,145,148,151,127,206,271,448'); ?>

but I don't know where that function is defined, or how to set pages to appear or not appear in the main navigation. It looks like certain pages are excluded there, by ID (?) but I don't know where to find the ID of the page I want excluded from the top nav.

Thanks for your help.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 36897292
wp_list_pages is a core function: http://codex.wordpress.org/Function_Reference/wp_list_pages

To find a Page ID, just go to the All Pages screen and hover over or click the Edit link for the page in question.  The ID is visible in the URL.  Once you have that, you add the ID to the exclude array above.
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

Author Comment

by:tablaFreak
ID: 36897367
That did the trick - thanks - but that worked fine as a hack, doesn't WordPress have a better way for a user to manage what's in the navigation? I'll accept your answer as the solution, but do you have any idea how the less saavy are expected to go about that?
Thanks, Jason.
0
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 2000 total points
ID: 36897390
It's not a hack :)  If the theme uses wp_list_pages(), this is how you have to go about it.

>> any idea how the less saavy are expected to go about that

See my first post.  It really is dependent on the theme you are using.  A well-developed theme should have support for custom menus via the wp_nav_menu() function (http://codex.wordpress.org/Function_Reference/wp_nav_menu).

So apparently my assumption was wrong and whomever developed this theme just took a shortcut (or developed it a long time ago, before custom menus were supported).  The "better" answer would be to add the code for the custom menus and use wp_list_pages() as a fallback (via the fallback_cb parameter) if no custom menu is defined.  Alternately, wp_page_menu() is the function that would automatically be used if no custom menu or custom fallback param is found by wp_nav_menu().
0
 

Author Comment

by:tablaFreak
ID: 36897460
Gotchya - thanks much for the clarification!
0
 

Author Closing Comment

by:tablaFreak
ID: 36897462
thanks for your speedy help!
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article, we will look at our content management system as a whole, to get an idea of how we will start to manage these content items.
This script checks a path to see if a folder exists. If the folder does exist you will get output "The folder has previously been created. No action taken" If not it will create the folder. Then adds one user modify permission to the folder. It …
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

782 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question