我想根据帖子类别为帖子添加内容。
我发现了以下代码,它在帖子上运行良好。但当我试图加载一个页面时,它却没有内容。
function my_category_content ( $content ) {
global $post;
if ( is_single() ) {
if ( in_category( "", $post->ID ) ) {
$content .= \'Only showing up on the categories named mini [product_category category="mini" limit="12" columns="4" orderby="date" order="desc"]\';
}
return $content;
}
}
add_filter( \'the_content\', \'my_category_content\' );