Reply To: Custom Taxonomy / Image in search

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Custom Taxonomy / Image in search Reply To: Custom Taxonomy / Image in search

#8582

Ernest Marcinko
Keymaster

Hi!

I have found a previous ticket where a similar issue was solved, and he also used the Featured Categories for images plugin.

Try to put this code into the functions.php file in your active theme directory:

add_filter('asp_results', 'asp_get_fifc_term_image');
function asp_get_fifc_term_image($results) {
 
  foreach($results as $k => $result) {
    if ($result->content_type != 'term') continue;
    $thumb_id = get_option( '_wpfifc_taxonomy_term_'.$result->id.'_thumbnail_id_' );
    if ($thumb_id !== false) {
      $image = wp_get_attachment_url( $thumb_id );
      if (!empty($image))
        $results[$k]->image = $image;
    }
  }
   
  return $results;
}

I have tried to log-in via FTP to test this, but it could not connect to the provided server. Let's hope this works.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)