php - 为下拉菜单编辑 php
问题描述
我想编辑我的下拉菜单,以便它直接从栏到实际菜单。
$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> ';
} 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().
}
html
<i class="fa fa-bars"></i>
</div>
<div class="module-group right">
<div class="module left">
<div class="collapse navbar-collapse navbar-ex1-collapse"><ul id="menu" class="menu"><li id="menu-item-3530" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-3530 dropdown"><a title="Contact" href="https://4309.co.uk/contact/">Contact </a><span class="dropdown-toggle shapely-dropdown" data-toggle="dropdown"><i class="fa fa-angle-down" aria-hidden="true"></i></span>
如果可以使用 CSS,那就太好了,但我想知道 php 可能不是唯一的解决方案。
解决方案
推荐阅读
- sql - 如果匹配已经存在,如何将行号附加到行插入?
- protractor - protractor + angular 6 库抛出错误:ReferenceError:未定义窗口
- c++ - 当从 int 中剥离位时,编译器会警告一个转换而不是其他转换。有解决方法吗?
- typescript - 哪个集合可用于双向映射键值对?
- c# - Office Addin 从一台 Windows 10 计算机上的 LocalCache 而不是 Roaming 文件夹中读取文件
- pdf - Arial Unicode Ms 不适用于投票箱的 xsl-fo
- python - 继续训练 FastText 模型
- java - 将重命名的文件作为输入传递给出站适配器/网关
- javascript - 角度组件中的对齐问题(CSS 问题)
- javascript - 如何捕获 Chrome 扩展上下文菜单的右键单击链接的*锚文本*