编辑PHP的下拉菜单

时间:2020-03-07 13:00:52

标签: php

我想编辑我的下拉菜单,以便它直接从条变为实际菜单。

docker-compose

HTML

$item_output = $args->before;

    /*
     * Glyphicons
     * ===========
     * Since the the menu item is NOT a Divider or Header we check the see
     * if there is a value in the attr_title property. If the attr_title
     * property is NOT null we apply it as the class name for the glyphicon.
     */
    if ( ! empty( $item->attr_title ) ) {
        $item_output .= '<a' . $attributes . '><span class="glyphicon ' . esc_attr( $item->attr_title ) . '"></span>&nbsp;';
    } else {
        $item_output .= '<a' . $attributes . '>';
    }

    $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;
    $item_output .= ( $args->has_children ) ? ' </a><span class="dropdown-toggle shapely-dropdown" data-toggle="dropdown"><i class="fa fa-angle-down" aria-hidden="true"></i></span>' : '</a>';
    $item_output .= $args->after;

    $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}// End if().
}

如果可以使用CSS,那很好,但是我想知道php可能不是唯一的解决方案。

here

1 个答案:

答案 0 :(得分:0)

您可以删除元素:

<span class="dropdown-toggle shapely-dropdown" data-toggle="dropdown"><i class="fa fa-angle-down" aria-hidden="true"></i></span>

然后您可以为.dropdown-menu的{​​{1}}类添加CSS规则:

ul

enter image description here