Custom Taxonomy / Image in search

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

This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 8 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #8573
    mammothreach
    mammothreach
    Participant

    I am trying to display a custom image using either a featured image or an ACF image field when displaying custom taxonomies. Is this possible? I was directed in the comment area to submit a ticket.

    Thanks!

    #8582
    Ernest Marcinko
    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 :)


    #8588
    mammothreach
    mammothreach
    Participant

    Worked like a charm. THANK YOU.

    #8589
    Ernest Marcinko
    Ernest Marcinko
    Keymaster
    You cannot access this content. Best,
    Ernest Marcinko

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


Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Custom Taxonomy / Image in search’ is closed to new replies.