Archived topic
Add comment number below comment title
4 replies · Started by George on October 28, 2020
I am adding the total comment below the comment title like this:
add_action( 'generate_below_comments_title','generate_comments_email_message' );
function generate_comments_email_message()
{
?>
<p class="total-comments">Total Comments:( 2 )</p>
<?php
}
and I want to replace the number 2 with the post comment count.
Any suggestions?
I used this code, is there a more streamlined way?
add_action( 'generate_below_comments_title','generate_comments_email_message' );
function generate_comments_email_message()
{
?>
<p class="total-comments">Total Comments: ( <?php comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1', 'generatepress' ), __( '%', 'generatepress' ) ); ?> ) </p>
<?php
}
Hi there,
thats a perfectly good way yo do it.
Tom does provide an option to include it in the meta here:
https://generatepress.com/forums/topic/comment-count-in-meta-of-single-post/#post-1478842
Ok, I will leave it as it is, then.
Thanks, David.
You're welcome