我正在使用wp_list_categories()
从特定的作者ID打印出每个类别的链接,这很好。然而,我还想添加一个div
致各li
将保留类别的图标。我怎样才能做到这一点?
这是我当前的代码:
<?php
// Display a list of all categories associated with author
$cat_array = array();
$args = array(
\'author\' => $author_id,
\'showposts\' => -1,
\'data-filter\' => \'category\',
\'ignore_sticky_posts\' => 1,
);
$author_posts = get_posts($args);
if($author_posts) {
foreach ($author_posts as $author_post ) {
foreach(get_the_category($author_post->ID) as $category) {
$cat_array[$category->term_id] = $category->term_id;
}
}
}
$cat_ids = implode(\',\', $cat_array);
wp_list_categories(\'include=\'.$cat_ids.\'&title_li=\');
?>