category featured image not displaying

Home Forums Product Support Forums Ajax Search Pro for WordPress Support category featured image not displaying

This topic contains 4 replies, has 2 voices, and was last updated by lkhlc lkhlc 9 years, 3 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #3381
    lkhlc
    lkhlc
    Participant

    have set the search results to show only categories, opening them goes to a custom script in a modal window.. the problem is, the category thumbnail featured image (added with Featured Images for Categories plugin) does not show up.. is there a wayh to use featured images with categories or if not where would i find the image location so i can load them in with custom code? thank you this is the last thing needed to finish this site project and i kinda sorta really need this done soon.. thanks
    lee

    #3382
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi!

    The only solution is to use a custom filter function. I did a quick search on that plugin, and did a basic code based on this documentation: http://helpforwp.com/plugins/featured-images-for-categories/

    Try to put this code to your themes functions.php file:

    
    add_filter( "asp_results", "asp_cfi_image_results", 1, 1 );
         
    function asp_cfi_image_results( $results ) {
       
      foreach ($results as $k=>$v) {
        // get the category images
        if ($results[$k]->image != null && $results[$k]->image != "")
           continue;
        if ($results[$k]->date == null || $results[$k]->date == "")
           $results[$k]->image = fifc_get_tax_thumbnail( $results[$k]->id, "category", "thumbnail");
      }
         
      return $results;
    }
    

    If the documentation is correct, then this should work. Please note however that I can’t provide 3rd party plugin support, so you might need to check with the plugin developer for the correct function to retrieve the category images. (if his documentation is incorrect or his code changed)

    Best,
    Ernest Marcinko

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


    #3383
    lkhlc
    lkhlc
    Participant

    Ernest you are amazing! Thank you. I put it into the functions file and the circle just keeps circling.. no results show up.. now. .not all categories have featured images yet would that cause the lack of loading?

    #3384
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    That’s most likely because the function I got from the other plugins documentation might not work as I expect (or not exist at all) and the function fails, thus throwing an error. I suppose that the “fifc_get_tax_thumbnail” function does not exist or does not work, or a different function is used.

    If you can ask the plugin developer how to retrieve the featured category image based on it’s ID, then all we need to do is replace that line in my code with that, and it’s going to work.

    Best,
    Ernest Marcinko

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


    #3385
    lkhlc
    lkhlc
    Participant

    Thank you sir! It is a pleasure dealing with you!

Viewing 5 posts - 1 through 5 (of 5 total)

The topic ‘category featured image not displaying’ is closed to new replies.