Hot answers tagged

3

This is most likely a result of different Screen Options selected between each site. While on the menu editor, look in the top right corner for the Screen Options pull down. On that panel, you should have the option to hide or show (via checkbox) details such as the title attribute, link target, CSS classes, etc.


2

Solution 1: Using customize walker I got some idea from add span class inside wp_nav_menu link anchor tag and make some change as your requirement. 1. Add this code below to your functions.php first. class Nav_Walker_Nav_Menu extends Walker_Nav_Menu{ function start_el(&$output, $item, $depth, $args){ global $wp_query; $indent = ( ...


2

Please Try with bellow : wp_nav_menu( array( 'theme_location' => 'header_menu', 'container_id' => 'menu', 'walker' => new description_walker() ) ); And Add functions.php class description_walker extends Walker_Nav_Menu{ function start_el(&$output, $item, $depth, $args){ global $wp_query; $indent = ( $depth ) ? ...


2

Not sure, but maybe something like this will work? Add to the functions.php. See explanation here. //This function is responsible for adding "my-parent-item" class to parent menu item's function add_menu_parent_class( $items ) { $parents = array(); foreach ( $items as $item ) { //Check if the item is a parent item if ( $item->menu_item_parent ...


2

If you are trying to get the post type for the current 'post', I think you could go with get_post_type(). Like this: $post_type = get_post_type(); Try it out.


1

As far as I am aware, there is no native way undo menu changes. However I did find this plugin Menus History, however I haven't tested it and it will only save changes in the future


1

Well, you wouldn't need a walker for that, if it's simply adding a data attribute or something like that you could just use the items_wrap parameter. View wp_nav_menu() in Resources: $items_wrap = '<div class="top-nav" mine="something">'; $items_wrap .= '<ul id="%1$s" mine="something2" class="nav %2$s">%3$s</ul>'; $items_wrap .= ...


1

There are a few ways to do this and they mostly revolve around the walker_nav_menu_start_el filter. I'd be inclined to add custom fields to the nav menu items: one for the image and one for the image's alternate text. That way, users can update the images and developers aren't required to keep a hash of all menu items and related image URLs/alt text in code ...


1

There is a navigation menu plugin extension for the REST API v2: https://wordpress.org/plugins/wp-api-menus/


1

You should call wp_nav_menu() in your footer.php template. It's used as following : <?php wp_nav_menu( array('theme_location'=>'footer') ); ?> The theme_location parameters refers to the checkboxes below the menu editor (Theme location). If your theme doesn't have enough theme_location, you can add some by adding function ...


1

Try using the following code. .current-menu-ancestor > ul { display:block; } The class current-menu-ancestor appears if the current item is a parent of a current page item.



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