您可以在最后一个li标记将您的标志(普通)html添加到菜单中。
<?php
function add_last_nav_item($items, $args) {
if ($args->menu->slug == \'topbar-menu\') { // change your menu slug name
// Add your html
$item = \'<li class="searchbox">
<input type="search" placeholder="Search......" name="search" class="searchbox-input" onkeyup="buttonUp();" required>
<input type="submit" class="searchbox-submit" value="">
<span class="searchbox-icon"><i class="fa fa-search"></i></span>
</li>\';
$items = $item.$items;
}
return $items;
}
add_filter( \'wp_nav_menu_items\', \'add_last_nav_item\', 10, 2 );
?>