Solved

Where is navigation set in WordPress

Posted on 2011-10-01
7
220 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
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 

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 500 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Do you think that WordPress is just for blogs?  Think again!  WordPress is really a fantastic all around platform that you can use to develop websites on.  Integrated into its basic functionality is the ability to create pages using your choice of a…
WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
The purpose of this video is to demonstrate how to create a Printer Friendly PDF on a WordPress Page. This will be demonstrated using a Windows 8 PC. Tools Used are Photoshop, Awesome Screenshot” Google Chrome Extension, and SmallPDF.com Log…
This video teaches viewers how to create their own website using cPanel and Wordpress. Tutorial walks users through how to set up their own domain name from tools like Domain Registrar, Hosting Account, and Wordpress. More specifically, the order in…

759 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now