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

Image for CPT taxonomy terms result

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Image for CPT taxonomy terms result

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17672
    frasermartinfrasermartin
    Participant

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

    #17673
    frasermartinfrasermartin
    Participant

    Not sure if my screenshot went up with the original post so here it is again.

    #17674
    frasermartinfrasermartin
    Participant

    As jpeg

    #17684
    Ernest MarcinkoErnest Marcinko
    Keymaster

    Hi 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

    #17693
    frasermartinfrasermartin
    Participant

    Thank 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?

    #17694
    Ernest MarcinkoErnest Marcinko
    Keymaster

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

    #17709
    frasermartinfrasermartin
    Participant

    Thank you Ernest. Filter fixes it.

    #17710
    Ernest MarcinkoErnest Marcinko
    Keymaster

    You cannot access this content.

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Image for CPT taxonomy terms result’ is closed to new replies.