我认为这是一个相当简单的问题,如果是,我很抱歉,但我如何添加<div>
此代码中的每个单独类别:
<?php
$taxonomy = \'category\';
// get the term IDs assigned to post.
$post_terms = wp_get_object_terms( $post->ID, $taxonomy, array( \'fields\' => \'ids\' ) );
// separator between links
$separator = \',\';
if ( !empty( $post_terms ) && !is_wp_error( $post_terms ) ) {
$term_ids = implode( \',\' , $post_terms );
$terms = wp_list_categories( \'title_li=&style=none&echo=0&taxonomy=\' . $taxonomy . \'&include=\' . $term_ids );
$terms = rtrim( trim( str_replace( \'<br />\', $separator, $terms ) ), $separator );
// display post categories
echo $terms;
}
?>
我想添加
<div class="btn-standard">
到每个类别。请注意,我只想显示与帖子相关的类别。