• Hi there,

    i have a question regarding the display order of attachments.

    in the admin gallery i can re-order the images, but how can i get that “new order” to display on the page itself?

    example:
    i have images 1 2 3 4 5 uploaded
    but i want them to display as: 1 5 4 2 3 (after i’ve re-ordered them in the gallery control)

    this is the code that i am using right now:

    $attachments = get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' =>'image', 'order' => 'ASC') );
    $nbImg = count($attachments);
    foreach ( $attachments as $attachment_id => $attachment ) {
    	echo "".wp_get_attachment_image( $attachment_id, array(0, 0) )."\n";
    }

Viewing 1 replies (of 1 total)
  • Moderator keesiemeijer

    (@keesiemeijer)

    maybe this will help:

    $attachments = get_children( array('post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' =>'image', 'orderby' => 'menu_order') );
Viewing 1 replies (of 1 total)
  • The topic ‘re-order attacments’ is closed to new replies.