Plugin Author
TC.K
(@wp_dummy)
Sure, you can use uwpqsf_get_cpt() filter to add attachment.
add_filter('uwpqsf_get_cpt','add_attachment_type');
function add_attachment_type($ptype){
array_push($ptype, "attachment");
return $ptype;
}
But, if you search attachment, it will only return the attachment file, not the posts that have that attachment. The taxonomy/meta fields also are from the attachment itself, not attachment parent post.
Wonderful! Love the use of filters
Gotcha, yes the site is using the attachment pages as standalone objects, as well as part of “collections” so I get what you are saying there.
Thanks for the quick reply!
Okay, the filter actually wasn’t able to add it to the results. The attachments checkbox is there in the backend but it is still not adding them to the results, still just posts.
With the standard search I was able to add attachments to the query like this http://brimosoft.nl/2013/04/03/search-for-attachments/ so the plugin is still not adding it to the otpions in the search somehow.
Ideas?
Plugin Author
TC.K
(@wp_dummy)
Oh, yes, forgot to tell you to include the ‘inherit’ status to the query.
To do so, you can use ‘uwpqsf_deftemp_query’ (for default search template) or ‘uwpqsf_query_args’ (for ajax search template) to add the parameter to the query.
eg
add_filter('uwpqsf_query_args', 'custom_search_query', '',3);
function custom_search_query($args, $id,$getdata){
$args['post_type'] = array( 'publish', 'inherit' );
return $args;
}
Tried with both filters and types of forms, but still not getting any result. Can you double check that?
Ah, got it, should be post_status up there instead of post_type. Now we’re good! Thanks again for the quality support!
Plugin Author
TC.K
(@wp_dummy)
Oh, you are right. That’s my typo.