Pergunta

I have a custom WP_Query that looks like this:

$this_page_id=$wp_query->post->ID; 
 $images = new WP_Query( array( 'post_type' => 'menu-item', 'post_parent' => $this_page_id ) );

My problem is that when using the orderby parameter (see here: http://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters) to sort by menu_order (which I need to do for the project). The sort order is not working.

I'm 99% certain the reason it's not working is because I'm directing it to query all children of a specific post and the orderby parameter doesn't "dig that deep into the query" if that makes sense to anyone.

Can anyone offer some help? doing this (the expected solution yields nothing):

$this_page_id=$wp_query->post->ID; 
     $images = new WP_Query( array( 'post_type' => 'menu-item', 'post_parent' => $this_page_id, 'orderby' => 'menu_order' ) );

Nenhuma solução correta

Licenciado em: CC-BY-SA com atribuição
Não afiliado a wordpress.stackexchange
scroll top