【问题标题】:WordPress Menus : Remove classes from ul for third levelWordPress 菜单:从 ul 中删除第三级的类
【发布时间】:2020-03-23 16:13:37
【问题描述】:

我正在使用Bootstrap nav walker

用于创建 WordPress 菜单。 它创造了什么

<ul id="primary-menu" class="navbar-nav ml-lg-auto font-weight-bold">
    <ul class="dropdown-menu animated fadeIn" aria-labelledby="menu-item-dropdown-119">
       <ul class="dropdown-menu animated fadeIn" aria-labelledby="menu-item-dropdown-119">
         <ul class="dropdown-menu animated fadeIn" aria-labelledby="menu-item-dropdown-119">

现在我不想在 UL 的第三和第四级添加课程。我该怎么做?没有JS可以吗?

【问题讨论】:

    标签: wordpress wp-nav-walker wp-nav-menu-item


    【解决方案1】:

    您可以为第三级和第四级菜单编写脚本。

    if ( $args->has_children && $depth === 0){ $class_names .= ' dropdown'; } elseif($args->has_children && $depth == 3){ $class_names .= ' '; }
    

    尝试类似的方法。

    【讨论】:

      猜你喜欢
      • 2016-07-26
      • 1970-01-01
      • 1970-01-01
      • 2014-12-16
      • 2023-04-06
      • 1970-01-01
      • 2018-08-18
      • 1970-01-01
      • 2012-11-15
      相关资源
      最近更新 更多