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 8 years ago.
- AuthorPosts
- May 4, 2016 at 4:42 pm #8573
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!
May 5, 2016 at 12:14 pm #8582Hi!
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 :)
May 5, 2016 at 9:57 pm #8588Worked like a charm. THANK YOU.
May 6, 2016 at 6:08 am #8589You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
The topic ‘Custom Taxonomy / Image in search’ is closed to new replies.