Hello everybody,
is there a way to sort attachments to a post similar to the gallery tab that shows the images connected to a post?
I want to change the order in the "gallery" tab and the query below should change the order of the posted attachments accordingly.
this is the code I am using:
<?php
$CP = $post->ID
?>
<?php query_posts('p=' . $CP . ''); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post();
$args = array(
'post_type' => 'attachment',
'numberposts' => -1,
'orderby' => 'name',
'post_status' => null,
'post_parent' => $post->ID
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $attachment ) {
echo '<li><p>';
echo wp_get_attachment_image( $attachment->ID, array(746,500) );
echo '</p></li>';
}
}
endwhile; endif; ?>
I know there is no such thing as:
'orderby' => 'gallery order',
but I hope you understand what I am searching for.