Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Image for CPT taxonomy terms result
- This topic has 7 replies, 2 voices, and was last updated 8 years, 1 month ago by
Ernest Marcinko.
-
AuthorPosts
-
April 29, 2018 at 6:39 am #17672
frasermartin
ParticipantI have created a search instance that includes searching CPT taxonomy terms. This is working nicely and the first search result returns the term and the count. But how do I get that result to show an image, even a default image would be fine?
Hope you can help.
Regards
FraserApril 29, 2018 at 6:40 am #17673frasermartin
ParticipantNot sure if my screenshot went up with the original post so here it is again.
April 29, 2018 at 6:44 am #17674frasermartin
ParticipantAs jpeg
April 30, 2018 at 12:11 pm #17684Ernest Marcinko
KeymasterHi Fraser,
It depends. By default there are no category images in WordPress. If you use a plugin to attach images to taxonomy terms, then let me know, I might be able to suggest a custom code to parse those images as well.
If you only need a default result image, when nothing is found, you can define that under the General Options -> Image Options panel: https://i.imgur.com/vxFXAfz.png
May 1, 2018 at 3:30 am #17693frasermartin
ParticipantThank you Ernest. I am already using the default result image, which for example on pages with no featured image, correctly show the default image I have set. But for some reason the taxonomy term result doesn’t show the default image. I checked the html output and no div.asp_item_img is output for that item. The taxonomy term has been correctly added to the General Options -> Sources 2. And it shows as the first search result item, including the correct items found count. But no default image shown.
The taxonomy is created by CMB2 plugin. I will investigate if there is a way to set a taxonomy feature image in the code.
In the meantime, is there a filter I can use in functions.php to set an image when none has been found?
May 1, 2018 at 9:50 am #17694Ernest Marcinko
KeymasterI think this is going to be a bug. I investigated the code, and it seems like the default image control is missing from the term results section. I will make sure to correct that for the upcoming release.
In the meantime, this custom code should help you out. Add this custom code to the functions.php in your theme/child theme directory (copy from line 3 only!). Before editing, please make sure to have a full site back-up just in case!
(change the $default_image_url variable to the default image URL desired)
May 2, 2018 at 3:44 am #17709frasermartin
ParticipantThank you Ernest. Filter fixes it.
May 2, 2018 at 8:35 am #17710Ernest Marcinko
KeymasterYou cannot access this content.
-
AuthorPosts
- The topic ‘Image for CPT taxonomy terms result’ is closed to new replies.