Page 8 of 8
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 5:32 am
by simonmlewis
But why is it now doing that - if I switch it back to the previous function and file, it doesn't do it. Is something in there making them all appear when they shouldn't?
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 5:34 am
by Celauran
Apparently. You'd need to dig through the code and find where get_comments is being called, and with which arguments. You can pull those arguments up to your get_comments call if you like, or you can modify whatever function calls get_comments by default and pull all of our changes higher. Either way seems fine, but the latter is obviously going to be more work.
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 5:39 am
by Celauran
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 6:03 am
by simonmlewis
I don't see that argument in the new code. What's puzzling me is why the 'NEW' code is "unlocking" the standard feature of showing only comments that are approved.
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 6:10 am
by Celauran
simonmlewis wrote:I don't see that argument in the new code.
That was my point.
simonmlewis wrote:What's puzzling me is why the 'NEW' code is "unlocking" the standard feature of showing only comments that are approved.
Because we're overriding the default behaviour in order to accomplish a set of goals the default behaviour doesn't allow for. We're necessarily doing things differently. Adding that missing key to the get_comments in the modified code should resolve the issue.
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 6:27 am
by simonmlewis
Adding it where....??
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 7:59 am
by Celauran
Do you see where post_id gets passed into get_comments? Just add another key/value pair to that array.
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 8:14 am
by simonmlewis
Code: Select all
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);
Changing the last bit ??
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 8:19 am
by Celauran
simonmlewis wrote:Code: Select all
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);
Changing the last bit ??
That's the right spot, but that syntax is no good and you're missing the status key. Try something like this
Code: Select all
$comments = get_comments(['post_id' => get_the_ID(), 'status' => 'approve']);
Re: Wordpress Pagination Links - how do I modify this?
Posted: Tue Sep 19, 2017 10:51 am
by simonmlewis
Gotcha. Can you see why when they post the comment it now doesn't show their 'own' new comment waiting for moderation?
It use to do that as a way of saying "we have it, just needs moderating".
I'm sure it's something down in that function that at the moment shows only if it's live.