In my blog each post contains 2 images: the featured image + another attachment image.
I'm currently calling the featured image with this code:
echo get_the_post_thumbnail_url();
And then using the following one to try and get the other attachment image:
$images = get_attached_media('image' );
$image = reset($images );
$ximage = wp_get_attachment_image_src($image->ID,'medium');
echo '' .$ximage[0] . '';
The problem is the second code seems to get a) the featured image or b) the other attachment image in a random way.
I would like to edit the second code, setting it to ignore the featured image, so it will always echo the other attachment image in all posts.
Something like:
exclude="' . get_post_thumbnail_id( $post->ID ) . '";
Is it possible?
Alternatively, is it possible to tell the second code to get the most recent uploaded attachment?