Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #322182

    How can I only display the date and comment count in the blog feed?

    #322294

    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

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.