Tag Info

Hot answers tagged

2

I've asked this question a bit to early, but to help others in the feature here's the solution. For the menu editor to appear, you need to register a menu first: add_action( 'init', 'register_header_menu' ); function register_header_menu() { register_nav_menu('header-menu',__( 'Header Menu' )); } Or as pointed out by Howdy_McGee: add_theme_support( ...


1

My solution to this problem when extending the Walker_Nav_Menu was to skip check if current_page_parent when C.P.T. I identified C.P.Ts following this stackexchange post. This does not entirely solve the problem as I am using current_page_item for C.P.T parent menu items, but it does achieve the desired outcome. Here is my class. class My_Menu extends ...


1

Since WordPress 3.0, you don't need a custom walker anymore! There is the walker_nav_menu_start_el filter, see https://developer.wordpress.org/reference/hooks/walker_nav_menu_start_el/ Example: function add_description_to_menu($item_output, $item, $depth, $args) { if (strlen($item->description) > 0 ) { // append description after link ...


1

I've made a free plugin which solves this problem! https://wordpress.org/plugins/wp-nav-menu-extended/ This plugin extends the native wp_nav_menu function and adds additional options: level : (integer) (required for this plugin to work) The level of the navigation menu to show. If no child_of parameter is passed, it shows all the items of this level ...



Only top voted, non community-wiki answers of a minimum length are eligible