• Resolved Chris Everson

    (@chriseverson)


    I’m having trouble convincing a get_children query to order.

    I’m using the code below to pull children of the current page two at a time.

    for ($i = 0; $i < 10; $i++,$i++) { // iterate through by two
    		$args = array ('post_parent'=>get_the_ID(),'post_status'=>'publish','numberposts'=>2,'offset'=>$i,'sort_order'=>'ASC'); // Build the query
    		$prods = get_children($args);
    		if(empty($prods)) continue; // Exit loop

    Everything is working perfectly with the one exception of sort_order. I’ve tried putting it in every position in the array and still nothing changes when I do ASC or DESC as the value.

    Any ideas? I feel like I’m just missing something obvious and need an extra set of eyes.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Michael

    (@alchymyth)

    i could not find ‘sort_order’ as a parameter of get_posts() or query_posts()

    try

    'order' => 'DESC'

    Thread Starter Chris Everson

    (@chriseverson)

    Wow. Thanks! I knew it was something stupid that I just overlooked.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘get_children => sort_order not working’ is closed to new replies.