admin管理员组文章数量:1418627
I tried to add a button to a the menu items which have children with the following code:
function add_button( $output, $item, $depth, $args ){
if (in_array("menu-item-has-children", $item->classes)) {
$output .='<button type="button" class="btn btn-circle"><i class="fa fa-chevron-circle-down"></i> </button>';
}
return $output;
}
add_filter( 'walker_nav_menu_start_el', 'add_button',10,4);
The problem is that are in the next row after the item, but i want them to appear right beside the item. How can I do that?
I tried to add a button to a the menu items which have children with the following code:
function add_button( $output, $item, $depth, $args ){
if (in_array("menu-item-has-children", $item->classes)) {
$output .='<button type="button" class="btn btn-circle"><i class="fa fa-chevron-circle-down"></i> </button>';
}
return $output;
}
add_filter( 'walker_nav_menu_start_el', 'add_button',10,4);
The problem is that are in the next row after the item, but i want them to appear right beside the item. How can I do that?
Share Improve this question asked Jul 25, 2019 at 11:24 xxrayxxray 11 Answer
Reset to default 0Please try something like this.
function add_button( $output, $item, $depth, $args ){
if (in_array("menu-item-has-children", $item->classes)) {
$output ='<button type="button" class="btn btn-circle">
<i class="fa fa-chevron-circle-down"></i>
</button>'.$output;
}
return $output;
}
add_filter( 'walker_nav_menu_start_el', 'add_button',10,4);
本文标签: Add button to menu item at the same row
版权声明:本文标题:Add button to menu item at the same row 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745296737a2652122.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论