I have to change the order of the image attachments that I add to my custom post types. They use the plugin called "WP Better Attachments" but there is no option to change the order in the backend (dragging, changing the title or time of upload does not change the order).
I searched for the code and this is what I found:
<?php
$id = icl_object_id(get_the_ID(), 'momenten', true, 'nl');
$attachments = get_posts( array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_parent' => $id ,
'exclude' => get_post_thumbnail_id()
) );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
$thumbimg = wp_get_attachment_image_src( $attachment->ID, 'bs-tumb', true );
$thumbimgbig = wp_get_attachment_image_src( $attachment->ID, 'large', true );
echo '<div class="small-12 medium-4 large-4 columns vxf" itemprop="associatedMedia" itemscope itemtype="http://schema.org/ImageObject">
<a href="'.$thumbimgbig[0].'" class="gallery-item" title="'.get_field('titel_afbeelding_'.ICL_LANGUAGE_CODE, $attachment->ID).'" itemprop="contentUrl" data-size="'.$thumbimgbig[1].'x'.$thumbimgbig[2].'"><img src="' . $thumbimg[0] . '" class="thumbnail" alt="'.get_post($attachment->ID)->post_title.'" temprop="thumbnail" ></a><div class="descrip" itemprop="caption description">'.get_field('titel_afbeelding_'.ICL_LANGUAGE_CODE, $attachment->ID).'</div></div>';
}
}
?>
Sadly my knowledge of php is limited so any kind of help will be greatly appreciated.