Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Thumbnails categories not showing at search results
- This topic has 10 replies, 2 voices, and was last updated 10 years, 10 months ago by
gutiseo.
-
AuthorPosts
-
July 27, 2015 at 9:34 am #5409
gutiseo
ParticipantHi,
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 10 years, 10 months ago by
gutiseo.
July 27, 2015 at 9:41 am #5410Ernest Marcinko
KeymasterHi!
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 🙂
July 27, 2015 at 9:44 am #5411gutiseo
ParticipantFeatured Images for Categories
https://wordpress.org/plugins/featured-images-for-categories/Thanks!
July 27, 2015 at 10:12 am #5413Ernest Marcinko
KeymasterHi!
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:
[php]
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;
}
[/php]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.
July 27, 2015 at 10:36 am #5414gutiseo
ParticipantI have added your code to functions.php but still not showing thumbnail categories.
Thanks!July 27, 2015 at 10:41 am #5415Ernest Marcinko
KeymasterThat’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.
July 27, 2015 at 10:44 am #5416gutiseo
ParticipantHi,
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 #5417Ernest Marcinko
KeymasterI 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.
July 27, 2015 at 10:52 am #5420gutiseo
ParticipantSftp changed in first post
ThanksJuly 28, 2015 at 1:26 pm #5425Ernest Marcinko
KeymasterHi!
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:
[php]
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;
}
[/php]July 28, 2015 at 4:17 pm #5426gutiseo
ParticipantIt works!
Thank you so much.
Regards -
This topic was modified 10 years, 10 months ago by
-
AuthorPosts
- The topic ‘Thumbnails categories not showing at search results’ is closed to new replies.