nav_menu_submenu_css_class Filter 修改子菜单 class

Posted in:
Update time:2020-10-27

functionality

过滤应用于菜单列表元素的CSS类。

parameters

parametersdata typedescriptive
$classesarrays应用于菜单的CSS类数组
$argsstdClasswp_nav_menu() 参数的对象
$depthinteger (math.)菜单深度,用于菜单级别和锁进

code example

需要修改 has-submenu 菜单类是,使用此 filter 修改,以适应我们的前端代码。

add_filter('nav_menu_submenu_css_class', function ($classes)
{
    $classes[] = 'has-submenu';

    return $classes;
});

We offer WordPress Themes and Plugins Custom Development Services

This site has long undertaken WordPress themes, plugins, WooCommerce-based store mall development business. We have 10 years of experience in WordPress development, if you want to Developing Websites with WordPress, please contact WeChat: iwillhappy1314 or email: amos@wpcio.com for inquiries.

发表回复

Your email address will not be published. 必填项已用 * 标注

*