我会尽量简短的。因此,基本上,我试图将自定义项添加到我的菜单中,在本例中,它是带有月份desc的归档下拉列表。一切看起来都很干净,但是.wp_get_archives的输出也忽略了所有的css。
function add_archive_dropdown($items, $args) {
if( $args->theme_location == 'primary' ){
$items .=''
.''
.'Archive'
.''
.''
.''
.''.'August 2018' .''
.''
.''
.wp_get_archives( array('type' => 'monthly', 'format' => 'html', 'show_post_count' => $c))
.''
.''
.'';
}
return $items;
}
add_filter('wp_nav_menu_items', 'add_archive_dropdown', 10, 2);结果:

发布于 2018-06-13 18:57:05
解决方案:“将'echo' => false,‘添加到参数数组中!”@bcworkz不同wp论坛
https://wordpress.stackexchange.com/questions/305946
复制相似问题