Hello,
is it possible to force the search icon on the header and the search block of the avia builder to search only in products?
Thanks
Hey marxsvjetlana64,
Try adding this code to the end of your functions.php file in Appearance ▸ Editor:
function avf_enable_cpt_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'product' ) );
$query->set( 'post_status', array( 'publish', 'inherit' ) );
}
return $query;
}
add_filter( 'pre_get_posts', 'avf_enable_cpt_search' );
Best regards,
Mike
Hi Mike, solved! Thanks a lot for your precious help!
Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.
Best regards,
Mike