How to add ID attribute to each submenu?

In your Walker_N_Menu class’s start_lvl() method, you’re setting the <ul>‘s id to submenu1. You can change this (using, in this example, the $depth parameter passed to start_lvl()) to be unique: function start_lvl( &$output, $depth = 0, $args = array() ) { // Depth-dependent classes. $indent = ( $depth > 0 ? str_repeat( “\t”, $depth ) … Read more

How can I make this custom menu work?

You need to target the appropriate theme_location. Assuming you’ve defined multiple nav menu locations using register_nav_menus() in functions.php: <?php register_nav_menus( array( ‘primary-menu’ => ‘Primary Menu’, ‘secondary-menu’ => ‘Secondary Menu’ ) ); ?> Then you call wp_nav_menu() using the appropriate theme_location as defined above, along with any other relevant arguments, e.g.: <?php wp_nav_menu( array( ‘theme_location’ => … Read more

Admin – Load existing admin template as a submenu page

You can add an interal link quite easily, it’s the same approach you use for adding custom items, you simply exclude a callback function and set the menu slug to the applicable URL, here’s an example. add_action( ‘admin_menu’, ‘add_user_type_link’ ); function add_user_type_link() { add_submenu_page( ‘users.php’, ‘Customers’, ‘Customers’, ‘edit_users’, ‘users.php?role=customers’ ); } Adjust the code as … Read more

Using default WP menu functionality to link to custom post-type listing?

Your best bet if you want them to show using the default drag and drop function is to register a custom taxonomy for the custom post type, http://codex.wordpress.org/Function_Reference/register_taxonomy. You can also use the taxonomies parameter when you register your CPT function. http://codex.wordpress.org/Function_Reference/register_post_type The alternative is to make a custom filter for your nav menu that … Read more

Creating a nav menu

First, be sure your theme supports wp_nav_menu which is goes into a template file – such as header.php – with the template tag function <?php wp_nav_menu( $args ); ?> which also requires a function in functions.php. See http://codex.wordpress.org/Function_Reference/wp_nav_menu That will initiate the WordPress 3 menu system that will appear in Dashboard>>Appearance>>Menus Next, read http://codex.wordpress.org/WordPress_Menu_User_Guide on … Read more