The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant
How to show limited...
 
Notifications
Clear all

Question How to show limited comments with “Load More” on a specific page only?

2 Posts
2 Users
0 Reactions
291 Views
Posts: 1
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@daniel)
New Member
Joined: 1 month ago
[#11133]

Hi there,

I’m using wpDiscuz on a website where one specific page acts as a small “micro-comment feed”. The site owner posts regular updates, and visitors can reply so it becomes an interactive conversation thread.

For that one page, I’d like to limit the number of comments initially shown (to keep the section from becoming too tall) and then show either pagination or a “Load more” button.
On all the other pages and posts of the site, wpDiscuz should continue to display the comments normally, without pagination or limits.

However, none of the approaches suggested by AI tools work so far.

I’m using the shortcode
[wpdiscuz_comments]
inside a Code Module in Divi.

Here’s an example of code that was suggested but does not work:

function custom_wpdiscuz_comment_order($order, $post_id) {
if ($post_id == 123) { // Specific page ID
return 'DESC'; // Newest first
}
return $order;
}
add_filter('comment_order', 'custom_wpdiscuz_comment_order', 10, 2);

Do you have any recommendations on whether it’s possible to limit the number of visible comments or enable “Load more” only on one specific page, while keeping the default behaviour everywhere else?

Thanks in advance!


1 Reply
Asti
Posts: 8211
 Asti
Support
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
(@asti)
Illustrious Member
Joined: 8 years ago

Hi,

Please find the code below: 

//comments_per_page
add_filter('wpdiscuz_comments_args', function ($args) {
    $postId   = 84;
    $commentPerPage = 2;
    if ($args['post_id'] === $postId) {
        $args['number'] = $commentPerPage;
    }
    return $args;
});

Reply
Share: