Given that you want to include a picture in the wp_nav_menu
output, your best bet is to use the wp_nav_menu_items
filter, as suggested in the comments. This will allow you to do a search and replace on the html.
add_filter ('wp_nav_menu_items','wpse229358_filter_menu');
function wpse229358_filter_menu ($items,$args) {
$search=""; // html string of button
$replace=""; // html string of picture+name
if (yourcondition) {
str_replace ($search,$replace,$items);
}
}
Related Posts:
- Get Current Menu Location inside Nav_Walker
- Remove unwanted elements for a wp_nav_menu
- How to show only the last two categories in a menu?
- How to give a NavWalker its own stylesheet?
- add_menu_page() with different name for first submenu item
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Change the_title() of a page dynamically
- How do I programatically insert a new menu item?
- Add Dividers or Separators Between Nav Menu Items
- Nav Menu meta failing to import
- Overwriting Core WordPress Functions with Plugins
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- Can I add pages to my custom menu via script?
- Replacing WordPress menu functionality with a plugin
- Hook event for upload image in the menu
- Why isn’t the Settings API designed to work for plugins using custom admin menus? [duplicate]
- How do I approach removing menu items on the fly based on settings in my plugin?
- What is the difference between current_page_parent and current_page_ancestor?
- Delete a specific item menu when I deactivate my plugin
- Create a Page via plugin
- Add Submenu Link in add_submenu_page That Opens in a New Window
- How to assign a WP 3.0 custom nav menu to a theme’s navigation menu location via script?
- Header Button Chance Polylang Elementor
- PHP 7 – Class Method Compatibility Issue
- How to add pages to custom menus on the fly [duplicate]
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- Add notification bubble notice in navigation using transients
- Adding custom fields to WordPress nav menus
- Sub Menu content is being duplicated
- Plugin menu addition in multisite
- Is this best practice for Dynamically adding items to WordPress menus?
- How to remove or add submenu item on plugin activate or deactive
- Custom code for WordPress dynamic menu
- How do I access the menus produced by Dashboard > Appearance > Menus
- wordpress add_submenu_page adds broken link
- WP Enqueue style on all plug-in pages
- Add child pages to submenu automatically
- Menu page with minimum capability as ‘Subscriber’ doesn’t allow ‘Admin’ to access it?
- Issue with plugin sub menu and pages
- How to add Plugin functionality in WordPress Frontend Menus
- How to hide page links from theme menu
- WP_NAV_MENU filter targets all menus
- How do I add a menu item to a Pods admin menu?
- Add user managable titles to custom menus?
- How to create archive page to add in menu
- Always hide a page from the menu
- remove different admin menu for specific users
- How to get an array out of a nav menu if it’s a plugin?
- What happens when you create/edit a menu
- Plugin admin list pages as submenu
- Adding parent custom post type menu option
- Create and style menu
- Change the class of wordpress menu
- Invalid Menu Items
- Declaration of mandoe_menu_walker::start_el(&$output, $item, $depth, $args) must be compatible with Walker::start_el(…)
- Custom Nav Walker $item->url producing malformed hyperlinks
- Displaying an Uploaded Image as a Custom Avatar in WordPress
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Hide menu items from not logged in users
- adding an options menu that allows saving multiple sets of said options
- Does WordPress default CSS have Grids?
- Gravity Forms Anchor only on Front Page?
- shortcode tags not working in do_shortcode
- How to show parents of current page category, excluding the category?
- How to create taxonomy without using register_taxonomy () function
- Add a custom menu item that supports wildcards
- Custom menu walker – remove li tag based on class name
- jQuery UI tab does not work in the plugin page
- Using HTML links within translatable string
- AJAX call returns ‘testtest0’ instead of ‘test’ – why?
- get_plugins() is not give plugin list after performed delete_plugins()
- Working of foreach loop with array
- How to find list of all functions bind to a particular hook from my plugin?
- Best practice for Designing a Plugin with this scenario
- How to resize WordPress images on upload to specific height and width without cropping it
- Replace first occurence of a word with link [closed]
- Converting core modification to a plugin
- WordPress plugin cron working only if admin is logged in
- How to convert the argument of wp_list_pages to an array
- Soap web service request from wordpress plugin
- How to rename the plugin PHP file without affecting existent users?
- Add location tag to wordpress posts
- Open tab on current day problem jQuery and WordPress
- How to change the menu mark up with walker_nav_menu class?
- Why does comments_open() return false when publishing a scheduled post?
- Using delete_post_meta for deleting multiple selected options
- get_shipping_methods() return empty rate
- Can I Hook Into the TinyMCE Insert/Edit Link Button to Use Shortlink For Post?
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- Ajax function is not working on WordPress
- Best way to ping for the API changes in the wordpress?
- when i activate my plugin i want to auto create pages with shortcodes
- Auto-complete or auto-suggest from stored data in database
- Best way to distribute templates and code accross multiple wordpress sites?
- Show Sidebar Menu Subpages When Clicking Parent
- Schedule some work in custom plugin
- What is the replacement for rich_edit_exists()?
- Disable Auto-Expanding Menu in WordPress Admin Menus
- How to overwrite iris color pallates from theme to plugin