I have added a custom field to the image attachement. When this custom field is checked the image will be part of a carousel on the home page. Now i am able to get the custom field to work and save the selected value, but how do i query the database so only the post with the custom field checked will be selected and their parent post.
In the end i want a shortcode with output like:
<a href="link-to-permalink-post"><img alt="attachment-title" src="img-src-link"/></a> <div class="caption"><p>attachment-title</p></div>
I think in need to use get_post_meta but how??