wordpress技术文章

wordpress详情页里调用分类和标签

日期:2020-05-28 阅读:590

 
调用分类:
<div class="entry-categories"><?php esc_html_e( 'Categories:', 'hestia' ); ?>
<?php
foreach ( $categories as $category ) {
echo '<span class="label label-primary"><a href="' . esc_url( get_category_link( $category->term_id ) ) . '">' . esc_html( $category->name ) . '</a></span>';
}
?>
</div>
----------
调用标签:
<?php 
 
the_tags( '<div class="entry-tags">' . esc_html__( 'Tags: ', 'hestia' ) . '<span class="entry-tag">', '</span><span class="entry-tag">', '</span></div>' ); 
?>