Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Category Images in Search Results Not Showing? › Reply To: Category Images in Search Results Not Showing?
March 23, 2015 at 9:40 am
#4318
Yes, we are talking about the same thing.
I think I know why it isn’t working. Version 4.0 just rolled out a few days ago, you might not get a notification from codecanyon.
If you update, this solution should work.
If you don’t want to update (if you have custom code or something applied), then try this code instead, it will probably work with version 3.5:
add_filter('asp_results', 'asp_get_woo_term_image');
function asp_get_woo_term_image($results) {
foreach($results as $k => $result) {
if (function_exists('get_woocommerce_term_meta') && empty($result->image)) {
$thumbnail_id = get_woocommerce_term_meta( $result->id, 'thumbnail_id', true );
$image = wp_get_attachment_url( $thumbnail_id );
if (!empty($image))
$results[$k]->image = $image;
}
}
return $results;
}
Best,Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)