Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › category featured image not displaying
- This topic has 4 replies, 2 voices, and was last updated 11 years, 5 months ago by
lkhlc.
-
AuthorPosts
-
January 6, 2015 at 5:39 pm #3381
lkhlc
Participanthave 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
leeJanuary 6, 2015 at 5:53 pm #3382Ernest Marcinko
KeymasterHi!
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:
[php]
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;
}
[/php]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)
January 6, 2015 at 6:04 pm #3383lkhlc
ParticipantErnest 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?
January 6, 2015 at 6:14 pm #3384Ernest Marcinko
KeymasterThat’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.
January 6, 2015 at 6:19 pm #3385lkhlc
ParticipantThank you sir! It is a pleasure dealing with you!
-
AuthorPosts
- The topic ‘category featured image not displaying’ is closed to new replies.