How can I only display the date and comment count in the blog feed?
Hi indy1003!
Tbh I didn’t test the code but it should work . insert it at the end of enfold/functions.php or your child theme functions.php:
// add custom feed content
function add_feed_content($content) {
if(is_feed()) {
global $post;
$date = get_post_field('post_date', $post->ID);
$comments = get_post_field('comment_count', $post->ID);
if($comments > 1)
{
$comments .= ' comments';
}else if($comments == 1){
$comments .= ' comment';
}else{
$comments = 'No comments';
}
if($date) $content .= '<p>Published: '.$date.'</p>';
if($comments) $content .= '<p>'.$comments.'</p>';
}
return $content;
}
add_filter('the_excerpt_rss', 'add_feed_content');
add_filter('the_content', 'add_feed_content');
Cheers!
Peter