我正在尝试将该类别添加到post meta。php文件,这样博客页面不仅会显示作者和日期,还会显示每篇文章的类别。然而,我似乎找不到任何正确的方法来这样做。当前代码如下:
<span class="post-meta">
<?php
$author = "<a href=\'" . esc_url( get_author_posts_url( get_the_author_meta( \'ID\' ) ) ) . "\'>" . esc_html( get_the_author() ) . "</a>";
$date = "<a href=\'" . esc_url( get_month_link( get_the_date( \'Y\' ), get_the_date( \'n\' ) ) ) . "\'>" . date_i18n( get_option( \'date_format\' ), strtotime( get_the_date( \'r\' ) ) ) . "</a>";
?>
<?php printf( _x( \'Published by %1$s on %2$s\', \'This blog post was published by some author on some date\', \'author\' ), $author, $date ); ?>
有人能帮我做这个吗?谢谢