There is no option for this, but you can extend the ‘walker’ object that WordPress uses to create the menu HTML. Only one method needs to be overridden:
class My_Walker_Nav_Menu extends Walker_Nav_Menu {
function start_lvl(&$output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent<ul class=\"my-sub-menu\">\n";
}
}
Then you just pass an instance of your walker as an argument to wp_nav_menu
like so:
'walker' => new My_Walker_Nav_Menu()
Related Contents:
- Using WPDB in standalone script?
- Remove category & tag base from WordPress url – without a plugin
- PHP Warning: POST Content-Length of 8978294 bytes exceeds the limit of 8388608 bytes in Unknown on line 0
- Can I install/update WordPress plugins without providing FTP access?
- WordPress putting %E2%80%8E at the end of my url, howcome?
- WordPress Site Keeps Getting Hacked
- How can I get the current page name in WordPress?
- WordPress filter to modify final html output
- Get cart item name, quantity all details woocommerce
- Retrieve WordPress root directory path?
- WooCommerce: Add input field to every item in cart
- Woocommerce checkout page internal server error
- Removing and tags in WordPress posts
- How to include pagination in a WordPress Custom Post Type Query
- WordPress asking for my FTP credentials to install plugins
- WordPress REST API (wp-api) 404 Error: Cannot access the WordPress REST API
- How do I debug a WordPress plugin?
- WP – Use file in plugin directory as custom Page Template?
- pagination on custom post wp_query
- Why is WordPress placing “text/rocketscript” instead of “text/javascript” when using wp_register_script()?
- Remove category and tag base from WordPress URLs without a plugin?
- Warning: preg_replace(): Unknown modifier
- Get Order items and WC_Order_Item_Product in WooCommerce 3
- TypeError: ‘undefined’ is not a function (evaluating ‘$(document)’)
- Access denied for user ‘root@localhost’ (using password:NO)
- The plugin generated X characters of unexpected output during activation (WordPress)
- Correct file permissions for WordPress [closed]
- Column count doesn’t match value count at row 1
- WooCommerce action hooks and overriding templates
- PHP – Merging two arrays into one array (also Remove Duplicates)
- How to call ajax in WordPress
- With “magic quotes” disabled, why does PHP/WordPress continue to auto-escape my POST data?
- How to include WordPress functions in custom .php file?
- Check if a user/guest has purchased specific products in WooCommerce
- Create a folder if it doesn’t already exist
- WooCommerce: Assigning an endpoint to a custom template in my account pages
- WooCommerce: Add product to cart with price override?
- MySQL Order before Group by
- Hide shipping methods for specific shipping class in WooCommerce
- Add a new custom field to WooCommerce checkout and display on admin order pages and email notifications
- query_posts() should be avoided?
- Php – Your PHP installation appears to be missing the MySQL extension which is required by WordPress
- Insert PHP code In WordPress Page and Post
- Replace woocommerce_add_order_item_meta hook in Woocommerce 3.4
- #1273 – Unknown collation: ‘utf8mb4_unicode_ci’ cPanel
- WooCommerce: Set country by default in checkout page
- How should I change the woocommerce_form_field HTML Structure?
- Display custom order meta data value in email notifications WooCommerce
- Multiple excerpt lengths in wordpress
- How to load all server side data on initial vue.js / vue-router load?