You can modify your menu by using walker.
include('subMenu.php');
$menu = wp_nav_menu( array('menu' => 'YOUR-MENU-NAME','menu_class' => 'megamenu','walker' => new subMenu));
create a file subMenu.php in theme folder add below code.
<?php
class subMenu extends Walker_Nav_Menu {
function end_el(&$output, $item, $depth=0, $args=array()) {
if( 'Item 3' == $item->title ){
$output .= '<ul class="sub-menu">
<li class="menu-item" id="menu-item-48"><a href="http://www.example.com/child1.com">child 1</a></li>
<li class="menu-item" id="menu-item-49"><a href="http://www.example.com/child2.com">child 2</a></li>
<li class="menu-item" id="menu-item-50"><a href="http://www.example.com/child3.com">child 3</a></li>
</ul>';
}
$output .= "</li>\n";
}
}
Related Posts:
- Some nav-menu filters do nothing
- Determine which theme location a wp_get_nav_menu_items is for
- How do I access the menus produced by Dashboard > Appearance > Menus
- Redirect to another page using contact form 7? [closed]
- Add child pages to submenu automatically
- WP_NAV_MENU filter targets all menus
- How do I add CSS options to my plugin without using inline styles?
- How can I load a page template from a plugin?
- Change the_title() of a page dynamically
- Add custom menu item using wp_nav_menu_items filter
- Using query_vars filter
- Add Dividers or Separators Between Nav Menu Items
- How to get Post ID with the Add Filter Function
- How do I Make a Theme “plugin-ready”?
- Overwriting Core WordPress Functions with Plugins
- How to modify post content before writing to database?
- How to prevent loading of all plugin’s resources?
- Display only certain posts based on visitor’s country?
- How to use filter hook ‘post_updated_messages’ in coherence with action hook ‘save_post’
- Is it possible to create an action hook using do_action() within add_action()?
- Dynamically Override Fancy Title
- Hook event for upload image in the menu
- How to allow Unfiltered HTML in a wordpress multisite install
- What is better way to use Bootstrap inside admin panel?
- How do I approach removing menu items on the fly based on settings in my plugin?
- Changing bloginfo description from a plugin
- wp_enqueue_style built in styles
- Is there a way to verified if an add_filter is already applied?
- multiple functions with same filter
- Woocommerce – Hide a Column in Cart Table
- Backslashes being stripped from CSS
- 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?
- How to check if a stylesheet is already loaded?
- how to include javascript file and css file in wordpress
- How to add pages to custom menus on the fly [duplicate]
- How can I add a CSS rule to edit.php?
- How do I add a custom sublevel menu specified in one directory to a custom top level menu specified in another directory?
- add_filter : Passing an array instead of the callback function?
- How do I alter the comment form ‘allowed tags’ text in a plugin?
- How do I include background images in my stylesheets in a plugin?
- What parameter should I pass to wp_enqueue_style to depend on the themes stylesheet?
- Namespaced action and filter tags
- Is there a Filter that I can use to filter the tags before they are inserted in to the database?
- WordPress is automatically linking plain text email addresses
- Is there no admin ui guide for 4.x?
- How can I make this custom menu work?
- From a page, is it possible to find entry’s “menu_item_parent”?
- Remove unwanted elements for a wp_nav_menu
- Can’t get woocommerce_get_price_html to work [closed]
- Is this best practice for Dynamically adding items to WordPress menus?
- Search and Filter
- How to remove or add submenu item on plugin activate or deactive
- WordPress custom taxonomy check box to dropdown
- Using ob_get_content to get_search_form puts into infinite loop
- CSS not affecting widget output
- Remove an action by extending class and replacing it
- Proper way to include stylesheet for panels
- Call to undefined function is_home() or any conditional tags
- How to buid wordpress menu with auto width sub-menu items in dropdown menu without any items sharing one line [closed]
- WooCommerce change Tax Class programmatically when Recalculating an existing Order [closed]
- How to add Plugin functionality in WordPress Frontend Menus
- Does WordPress default CSS have Grids?
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- How to insert HTML/CSS/JS into my iframe plugin?
- How to hide page links from theme menu
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- How do I add a menu item to a Pods admin menu?
- Load stylesheet in edit category page?
- Controlling sub-menu within sub-menu
- How do i remove the title from a specific page
- Is there an action_filter hook to add content before the post title?
- CSS not being applied using wp_enqueue_style
- Adding tables to dashboard pages programmatically?
- Conditional custom menu?
- How to add some basic inline CSS using existing plugin or theme?
- Limit get_next_post to posts from the same author
- Any way, hook to add content right before the “read more” link?
- Redirect theme directory to plugin theme directory
- remove different admin menu for specific users
- WordPress Reset password Strength set to medium
- Display specific main Sub Nav on Woocommerce product pages
- Modify search form with plugin
- Single_template for a custom post type created from a plugin is returning an empty page
- How to get an array out of a nav menu if it’s a plugin?
- Confusing $tag specification for apply_filters call, in core options.php code
- How put the correct URL to sub-menu plugin?
- WordPress permalink setting
- Always show wordpress submenu on responsive header menu
- edit-tags.php in plugin admin menu hides when is the active page
- Adding parent custom post type menu option
- Create and style menu
- Apply Filters Causing a 500 Internal Server Error
- add_filter adds output in the head
- Add “sub-nav” class to a sub menu parent item
- Apply function on all action hooks?
- Custom Nav Walker $item->url producing malformed hyperlinks
- How to create A – Z List with pictures?
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Ninja Forms: Front-End Forms, Post ID?