Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 6035

Navigation Menu is a theme feature introduced with Version 3.0. WordPress includes an easy to use mechanism for introducing customised navigation menus into a theme. In order to incorporate menu support into your theme, you need to add a few code segments to your theme files.

6 votes

How to hide an item from a menu to logged out users (without a plugin)

Filter wp_nav_menu_objects. It will contain the sorted list of nav menu items to render. Have a look at wp_setup_nav_menu_item for some properties you can use. Here's a quick (untested) example. add_f …
chrisguitarguy's user avatar
3 votes

how to only add a top-level admin menu without it creating a sub-level-menu

There's not really a good way to do this. Checkout the _wp_menu_output function. It's where all the work gets done for the menu output. See that $submenu_as_parent parameter and how it's used? Setting …
chrisguitarguy's user avatar
8 votes

wp_nav_menu: show menu only if one exists, otherwise show nothing

You can just specify false as the fallback_cb argument of wp_nav_menu. Nothing will show up -- rather, wp_nav_menu will return false (echoing nothing out). <?php wp_nav_menu(array( 'theme_locat …
chrisguitarguy's user avatar
1 vote
Accepted

Removing Submenu from Menu

You can change nav menu args via the wp_nav_menu_args filter. So let's say you have a theme that does something like this... <?php wp_nav_menu(array( 'theme_location' => 'second_level', 'd …
chrisguitarguy's user avatar
1 vote
Accepted

How to change theme header to support multiple nav menus?

First off, some things you should know about nav menus: Menus are simply terms in a taxonomy called nav_menu. … } } Notice the helper method to retrieve the nav menus. …
chrisguitarguy's user avatar
1 vote

Is custom menu name and category name linked in wordpress?

Nav Menus are actually taxonomies -- eg. they are registered with register_taxonomy and get used to associated menu items (which are, of course, a custom post type!). …
chrisguitarguy's user avatar
2 votes
Accepted

Menus, but not by theme location

wp_nav_menu takes an optional argument called menu, which will fetch any menu by name, slug or ID. If you just want post objects (or anything but the menu HTML), wp_get_nav_menus is the way to go. …
chrisguitarguy's user avatar
4 votes
Accepted

Count within foreach loop

Insert a new $counter variable before the foreach loop starts, and at the very end of the loop, call $counter++ to increment the number. In the middle, just echo out the $counter variable. <?php $p …
chrisguitarguy's user avatar