I am using the following simple get attachment code to display all images attached to a certain post but I want to be able to exclude the images uploaded via a couple of custom meta boxes that are also attached to the post.
For example, how could I exclude an image uploaded with a meta key of sample_image_1 from this code?
<?php
$args = array (
'post_type' => 'attachment',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID,
);
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
the_attachment_link( $attachment->ID , 'screenshot' );
}}
?>