This website uses cookies to personalize your experience. By using this website you agree to our cookie policy.

Thumbnails categories not showing at search results

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Thumbnails categories not showing at search results

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #5409
    gutiseogutiseo
    Participant

    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 10 years, 10 months ago by gutiseogutiseo.
    #5410
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    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 🙂

    #5411
    gutiseogutiseo
    Participant

    Featured Images for Categories
    https://wordpress.org/plugins/featured-images-for-categories/

    Thanks!

    #5413
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    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.

    #5414
    gutiseogutiseo
    Participant

    I have added your code to functions.php but still not showing thumbnail categories.
    Thanks!

    #5415
    Ernest MarcinkoErnest Marcinko
    Keymaster

    That’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.

    #5416
    gutiseogutiseo
    Participant

    Hi,
    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?
    Thanks

    #5417
    Ernest MarcinkoErnest Marcinko
    Keymaster

    I 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.

    #5420
    gutiseogutiseo
    Participant

    Sftp changed in first post
    Thanks

    #5425
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi!

    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]

    #5426
    gutiseogutiseo
    Participant

    It works!
    Thank you so much.
    Regards

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Thumbnails categories not showing at search results’ is closed to new replies.