<!-- Display Categories Assigned to a post -->
<?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 ) ) {
$gterms = wp_list_categories( array(
\'title_li\' => \'\',
\'style\' => \'none\',
\'echo\' => false,
\'taxonomy\' => $taxonomy,
\'include\' => $term_ids,
\'child_of\' => 193
) );
$gterms = rtrim( trim( str_replace( \'<br />\', $separator, $gterms ) ), $separator );
}
输入你的父猫id,例如,我有流派父类别,它有很多子类别,以显示与你当前帖子相关的子类别,输入父类别的id。要输出它,请使用plz
<?php echo $gterms; ?>