Wordpress Pagination Links - how do I modify this?
Moderator: General Moderators
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Wordpress Pagination Links - how do I modify this?
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?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Wordpress Pagination Links - how do I modify this?
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?
https://codex.wordpress.org/Function_Re ... t_comments
Looks like the status argument is what you're after.
Looks like the status argument is what you're after.
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Wordpress Pagination Links - how do I modify this?
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Wordpress Pagination Links - how do I modify this?
That was my point.simonmlewis wrote:I don't see that argument in the new code.
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.simonmlewis wrote:What's puzzling me is why the 'NEW' code is "unlocking" the standard feature of showing only comments that are approved.
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Wordpress Pagination Links - how do I modify this?
Adding it where....??
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Wordpress Pagination Links - how do I modify this?
Do you see where post_id gets passed into get_comments? Just add another key/value pair to that array.
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Wordpress Pagination Links - how do I modify this?
Code: Select all
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Wordpress Pagination Links - how do I modify this?
That's the right spot, but that syntax is no good and you're missing the status key. Try something like thissimonmlewis wrote:Changing the last bit ??Code: Select all
$comments = get_comments(['post_id' => get_the_ID()] ['post_id' => get_the_ID()]);
Code: Select all
$comments = get_comments(['post_id' => get_the_ID(), 'status' => 'approve']);
-
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Wordpress Pagination Links - how do I modify this?
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.
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.