I would really like my images to display in the same way I’ve ordered them in the media browser. What am I doing wrong?
$images =& get_children( array('post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'asc' ));
a) If you have reordered the images under the uploaded to this post in the media browser then they should have
menu_order>0
and you can get that order withb) If you haven’t, then
menu_order=0
for all these images and you will need to useto get the same order (or date asc).
A solution for both cases could be like this, in pure SQL:
If you try
you will get
Since
get_children()
is usingget_posts()
there are some restriction on how extra fields can be added to theorderby
andorder
parameters .You can also use your custom query, where you have full control over the double ordering: