Site logo

Archived topic

Add comment number below comment title

4 replies · Started by George on October 28, 2020

Viewing posts 1–5 of 5

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
}

Ok, I will leave it as it is, then.

Thanks, David.

You're welcome

This archived topic is closed to new replies.