0

I got this simple line: get_comments( 'post_id='.$newpost->ID.''); based on http://codex.wordpress.org/Function_Reference/get_comments

It works fine but I would like to order the posts in a different order. I've tried a lot of ways of writting it but it never seems to work.

How would I add one of these parameters?:

$orderby (string) (optional) Set the field used to sort comments. Default: comment_date_gmt $order (string) (optional) How to sort

$orderby. Valid values: 'ASC' - Ascending (lowest to highest). 'DESC' - Descending (highest to lowest). Default: DESC

Thanks for your help you guys!

1 Answer 1

1

Make an array with your variables:

get_comments( array('orderby' => 'ID', 'order' => 'ASC', 'post_id' => $newpost->ID) );
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.