wpDiscuz - WordPress Comment Plugin
How to show the cou...
 
Share:
Notifications
Clear all

[Solved] How to show the count of the comments left on the "Load more" button.

1 Posts
1 Users
0 Likes
1,414 Views
Asti
 Asti
(@asti)
Illustrious Member Support
Joined: 5 years ago
Posts: 5174
Topic starter  

Started from the wpDiscuz 7.3.10 version we've added two new hooks:

The wpdiscuz_show_comments_left is designed for showing the count of the parent comments left on the "Load more" button. By default, the count is not displayed. If you want to show it, just put the hook-code below in the active theme functions.php file: 

add_filter("wpdiscuz_show_comments_left", "__return_true");

This video shows how the hook-code works:

The second wpdiscuz_comments_left_text hook allows you to change the text, that displays the number of the parent comments that are not displayed yet on the "Load more" button. This is not required, you can use it just in case if you want to change the text.

For example:

add_filter("wpdiscuz_comments_left_text", function ($text, $args) {
    if (!empty($args["comments_left"])) {
        $text = "[{$args["comments_left"]}]";
    }
    return $text;
}, 10, 2);

In this case, the default (X) format will be replaced with [X].

hook result

This article describes how to easily add custom code in WordPress: https://www.wpbeginner.com/plugins/how-to-easily-add-custom-code-in-wordpress-without-breaking-your-site/

 

In case you want to say thank you! 🙂
We'd really appreciate if you leave a good review on the plugin page.
This is the best way to say thank you to this project and the support team.


   
Share: