最简单的解决方案是在the_content
:
function my_affiliates_descr($content) {
if (is_single() && has_category(\'affiliate\')) {
$content .= \'This is an affiliate post\';
}
return $content;
}
add_filter(\'the_content\',\'my_affiliates_descr\');
你可以把它和
category_description()
正如在对问题的评论中所建议的那样:
function my_affiliates_descr($content) {
if (is_single() && has_category(\'affiliate\')) {
$content .= category_description( get_category_by_slug(\'affiliate\')->term_id );;
}
return $content;
}
add_filter(\'the_content\',\'my_affiliates_descr\');