<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '" class="btn btn-warning">' . esc_html( $categories[0]->name ) . '</a>';
}
?>
个人建站知识管理
877 次浏览 分类: 我的站务
<?php
$categories = get_the_category();
if ( ! empty( $categories ) ) {
echo '<a href="' . esc_url( get_category_link( $categories[0]->term_id ) ) . '" class="btn btn-warning">' . esc_html( $categories[0]->name ) . '</a>';
}
?>
Optimized by WPJAM Basic。