以下是我在帖子中添加署名的代码。你能解释一下我是如何把分类法运用到这一点上的吗。分类法是目的地。
/*********************
CLEAN BYLINE
*********************/
if ( ! function_exists( \'cb_byline\' ) ) {
function cb_byline($cb_cat = true, $cb_post_id = NULL, $cb_short_comment_line = false, $cb_posts_on = false) {
$cb_meta_onoff = ot_get_option(\'cb_meta_onoff\', \'on\');
$cb_disqus_code = ot_get_option(\'cb_disqus_shortname\', NULL);
$cb_byline = $cb_cat_output = $cb_comments = NULL;
$cb_cats = get_the_category($cb_post_id);
if ( isset( $cb_cats ) && ( $cb_cat == true ) ) {
$cb_cat_output = \' <div class="cb-category"><i class="icon-folder-close"></i> \';
$i = 1;
foreach($cb_cats as $category) {
if ( $i != 1 ) { $cb_cat_output .= \', \'; }
$cb_cat_output .= \' <a href="\'.get_category_link( $category->term_id ).\'" title="\' . esc_attr( sprintf( __( "View all posts in %s", "cubell" ), $category->name ) ) . \'">\'.$category->cat_name.\'</a>\';
$i++;
}
$cb_cat_output .= \'</div>\';
}
if ( $cb_disqus_code == NULL ) {
if ( get_comments_number( $cb_post_id ) > 0) {
if ( $cb_short_comment_line == true ) {
$cb_comments = \' <div class="cb-comments"><span><i class="icon-comment"></i><a href="\' . get_comments_link( $cb_post_id ) . \'">\' . get_comments_number( $cb_post_id ) . \'</a></span></div>\';
} else {
if ( get_comments_number( $cb_post_id ) == 1) {
$cb_comment_line = __(\'Comment\', \'cubell\');
} else {
$cb_comment_line = __(\'Comments\', \'cubell\');
}
$cb_comments = \' <div class="cb-comments"><span><i class="icon-comment"></i><a href="\' . get_comments_link( $cb_post_id ) .\'">\'. get_comments_number( $cb_post_id ) . \' \'. $cb_comment_line .\'</a></span></div>\';
}
}
} else {
$cb_comments = \' <div class="cb-comments"><span><i class="icon-comment"></i><a href="\' . get_permalink( $cb_post_id ) . \'#disqus_thread"></a></span></div>\';
}
$cb_date = \' <div class="cb-date"><i class="icon-time"></i> <time class="updated" datetime="\'. get_the_time(\'Y-m-d\', $cb_post_id).\'">\'. date_i18n( get_option(\'date_format\'), strtotime(get_the_time("Y-m-d", $cb_post_id )) ) .\'</time></div>\';
if ( ( $cb_meta_onoff == \'on\' ) || ( $cb_posts_on == true ) ) {
$cb_byline = \'<div class="cb-byline">\' . $cb_author . $cb_date . $cb_cat_output . $cb_comments . \'</div>\';
}
return $cb_byline;
}
}
SO网友:fuxia
使用此选项:
get_the_term_list( $id, $taxonomy, $before = \'\', $sep = \'\', $after = \'\' );
在您的情况下,必须填写正确的值:
$destination = get_the_term_list(
$cb_post_id,
\'destination\',
\' <div class="cb-destination">\',
\', \',
\'</div>\'
);
然后添加
$destination
到
<div class="cb-byline">
.