• I use this one to out put all the attachment that are attached to the page.

    <?php
    			$args = array(
    			'order'          => 'ASC',
    			'post_type'      => 'attachment',
    			'post_parent'    => $post->ID,
    			'post_mime_type' => 'image',
    			'post_status'    => null,
    			'numberposts'    => -1,
    		);
    		$attachments = get_posts($args);
    		if ($attachments) {
    			foreach ($attachments as $attachment) {
    
    				echo wp_get_attachment_link($attachment->ID, 'thumbnail', true, true);
    			}
    
    		}
    		?>

    I can set the order as ASC or DESC but I would like it to be as the attachments are arranged in the Ad Image Gallery view. Sometimes it comes handy to reorder the images a bit.

    All help appreciated! Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I’ve not tried it with images/attachments but would adding 'orderby' => 'menu_order' to your get_posts arguments work?

    Thread Starter hilj

    (@hilj)

    Hey it works! Previously I thought it was order_by (with the underscore). Does the order have any meaning there now?

    Thanks again!

    Only if you used DESC to reverse the menu (gallery) order.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Controlling the attachment order?’ is closed to new replies.