janneman63
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Limiting comments to a certain amounts of days@bcworkz Thank you for your reply.
I managed to request the comments and display only the ones that fulfill my criteria but it did’t stop WP from displaying the normal comments also.
disabling the comments for the page did list my own list alone but also removed the form for new comments.
I think I now should look at the theme files, to see if I can change the behavior there. If I can prevent the listing in the Theme but allow the form then a plug-in can list the comments I want to display.
I have no need for nesting or comments on comments so that should be quite straightforward.
Thanks again for your thoughts.- This reply was modified 3 years, 4 months ago by janneman63.
Forum: Developing with WordPress
In reply to: Limiting comments to a certain amounts of daysfunction wpb_filter_comments_template( $template ) { global $wp_query; $wp_query->query_vars['date_query'] = array( array( 'after' => '7 days ago', ), ); return $template; } add_filter( 'comments_template', 'wpb_filter_comments_template' );This is what I came up with. comments_template was a second try I first tried something with pre_get_comments but nothing seems to have any effect on the native WP comments.