I am trying to select some attachements based on an attachement caption. I need to do this for a seperate download page. On the download page i want to display all attachment which caption equals "downloads". So this way i can be selective of post attachments which can and can't be downloaded
At the moment i have this code to select all the attached pdf's as downloable files, but i like to select some attached images and deselect some pdf's.
$args = array('post_parent' => $atts['product_id'],
'post_status' => 'inherit', 'post_type' => 'attachment',
'post_mime_type' => 'application/pdf', 'order' => $order, 'orderby' => $orderby);
$attachments = get_posts($args);
//print_r($attachments);
$i = 1;
foreach ($attachments as $attachment) {
...
$attachment->guid
i am also able to select images based on there given thumbnail name with
wp_get_attachment_image($attachment->ID,'product-slider-thumbnail')
but how to select based on caption??
regards