添加此代码函数。php
function replace_last_nav_item($items, $args) {
return substr_replace($items, \'\', strrpos($items, $args->after), strlen($args->after));
}
add_filter(\'wp_nav_menu\',\'replace_last_nav_item\',100,2);
添加此代码菜单
<?php
$defaults = array(
\'menu\' => \'footer-menu\',
\'container\' => \'ul\',
\'container_class\' => \'\',
\'container_id\' => \'\',
\'menu_class\' => \'\',
\'menu_id\' => \'\',
\'echo\' => true,
\'fallback_cb\' => false,
\'before\' => \'\',
\'after\' => \' | \',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'items_wrap\' => \'<ul>%3$s</ul>\',
\'depth\' => 0,
\'walker\' => \'\'
);
wp_nav_menu( $defaults ); ?>