1

I am trying to create a search template to search attachments uploaded to a custom post type called folders. This is what I have so far:

if ( $post->post_type == 'attachment' 
    && $post->post_parent == '343' 
    && $post->post_mime_type == 'application/pdf' ) 
{ 
    ?><a href="<?php echo wp_get_attachment_url( $post->ID, true ); ?>" target="_blank">
}

At the moment this searches for attachments uploaded to the post 343 what I need it to do is search any posts that belong to the folders custom post type.

  • Have you found a solution that you can share with us? – fuxia Aug 13 '16 at 9:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.