Hello,
This gets all the images attached to a post
<?php
$args = array(
'order' => 'ASC',
'orderby' => 'menu_order',
'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', false, false);
}
} ?>
I get a thumbnail image for the post in the beginning of the post and then in the end of the post I get the rest of the images. Now the first thumbnail image is also added in end of the post, where it should not be anymore.
Huge thanks for all the help!