I used the code below but it has two problems:
1. The comment count only appears on the archive page, not in a single post.
2. On the archive page, it shows in two places, below the Headline and also below the excerpt. When I turn off “Display comment count” using the Layout Customization then it disappears in both.
add_filter( 'generate_header_entry_meta_items', function() {
return array(
'author',
'date',
'comments-link',
);
} );
add_filter( 'generate_inside_post_meta_item_output', function( $output, $item ) {
if ( '' === $item ) {
return '';
}
if ( 'comments-link' === $item ) {
return ' • ';
}
if ( 'date' === $item ) {
return ' • ';
}
return $output;
}, 50, 2 );