Support » Plugin: Lazy Load for Comments » Displaying the number of comments on your load button

  • If you want to include the number of comments in the Load button text, you can use something like:

    add_filter( 'llc_button_text', function () {
    	$num_comments = get_comments_number();
    	if ( $num_comments == 0 ) {
    		$numcomments = __('There Are No Comments');
    	} elseif ( $num_comments > 1 ) {
    		$numcomments = 'There Are <span style="color:red">' . $num_comments . __('</span> Comments');
    	} else {
    		$numcomments = __('There Is <span style="color:red">1</span> Comment');
    	}
        return $numcomments . '<br />Click to Load &raquo;'; 
    });

    This is nothing brilliant or complicated, but it might save you a bit of time investigating yourself.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Where do I exactly add this?

    Thread Starter mojamba

    (@mojamba)

    Try adding it to your theme’s functions.php file. But, be careful because if you are not using a child theme and you update your core theme, the changes you make will be lost.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying the number of comments on your load button’ is closed to new replies.