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

This topic contains 10 replies, has 2 voices, and was last updated by gutiseo gutiseo 8 years, 8 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #5409
    gutiseo
    gutiseo
    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 8 years, 8 months ago by gutiseo gutiseo.
    #5410
    Ernest Marcinko
    Ernest 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 🙂

    Best,
    Ernest Marcinko

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


    #5411
    gutiseo
    gutiseo
    Participant
    #5413
    Ernest Marcinko
    Ernest 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:

    
    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 :)


    #5414
    gutiseo
    gutiseo
    Participant

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

    #5415
    Ernest Marcinko
    Ernest 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.

    Best,
    Ernest Marcinko

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


    #5416
    gutiseo
    gutiseo
    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 Marcinko
    Ernest 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.

    Best,
    Ernest Marcinko

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


    #5420
    gutiseo
    gutiseo
    Participant

    Sftp changed in first post
    Thanks

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

    
    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;
    }
    
    Best,
    Ernest Marcinko

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


    #5426
    gutiseo
    gutiseo
    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.