Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Thumbnails categories not showing at search results
This topic contains 10 replies, has 2 voices, and was last updated by gutiseo 9 years, 1 month ago.
- AuthorPosts
- July 27, 2015 at 9:34 am #5409
Hi,
I have setted up ajax search pro results behaviour to show categories but it doesn’t shows categories thumbnails . I used a thumbnail categories plugin in order to make each categorie have adifferent featured image but these thumbnails are not showing in search results.How can I fix this?
Thank you nd regards!
-
This topic was modified 9 years, 1 month ago by
gutiseo.
July 27, 2015 at 9:41 am #5410Hi!
Could you please link me to the plugin you are using to display category images? Since this is not a default WordPress feature, the search doesn’t know how to get the category images, that’s why they are not displaying. If you can send me the url of the plugin you are using I might be able to suggest a solution 🙂
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 27, 2015 at 9:44 am #5411Featured Images for Categories
https://wordpress.org/plugins/featured-images-for-categories/Thanks!
July 27, 2015 at 10:12 am #5413Hi!
So I checked the plugin documentation, and it looks like it’s there is a function to get the term image. Based on that I put together this small snippet:
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; if (function_exists('fifc_get_tax_thumbnail') && empty($result->image)) { $image = fifc_get_tax_thumbnail( $result->id, $result->taxonomy, 'thumbnail'); if (!empty($image)) $results[$k]->image = $image; } } return $results; }
Try to add this code to your active Theme functions.php file. It will try to get the images for each category after the search is done post processing.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 27, 2015 at 10:36 am #5414I have added your code to functions.php but still not showing thumbnail categories.
Thanks!July 27, 2015 at 10:41 am #5415That’s a bummer, I’m almost sure this should work if the plugin documentation is correct.
Can you provide temporary FTP access to check for errors a to run debugging? I might be able to find a solution.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 27, 2015 at 10:44 am #5416Hi,
if you need to change theme or plugins archives you can do it from wordpress because I have installed wp editor.
How could I send you ftp in private?
ThanksJuly 27, 2015 at 10:47 am #5417I definitely need to change code, and it’s safer to do via FTP, because if I accidentally make a syntax error in the plugin or theme editor, your site will go offline with an error message.
You can add private details If you edit your first post in this thread and fill out the ftp fields, or by uploading a .txt file with the details. Both methods are safe, and only visible for me and you.
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 27, 2015 at 10:52 am #5420Sftp changed in first post
ThanksJuly 28, 2015 at 1:26 pm #5425Hi!
Thanks for the details. Their documentation was incorrect, it was not working actually. However I have tracked down the method of how to get the thumbnail, it should work now. I have changed the code I’ve sent you before. For future reference I’m leaving it here:
Best,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; }
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
July 28, 2015 at 4:17 pm #5426It works!
Thank you so much.
Regards -
This topic was modified 9 years, 1 month ago by
- AuthorPosts
The topic ‘Thumbnails categories not showing at search results’ is closed to new replies.