Reply To: Images in search results – sources

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Images in search results – sources Reply To: Images in search results – sources

#9071
nazar
nazar
Participant

Hiya Ernest,

I believe, the most ‘standard’ way is the native term meta: https://www.smashingmagazine.com/2015/12/how-to-use-term-meta-data-in-wordpress/
I usually use either that (yep, coding everything manually) or Pods (when my customers need a GUI).

I checked your code snippets in those threads and I can see different approach depending on plugins/functions used, however, I’m kinda stuck with writing a proper filter for my case.
In my current setup I have the following combination of search sources: 1 CPT, 2 custom taxonomies, 1 custom field.
In plain English: Listing (CPT), Listing Category and Listing Region (hierarchical taxonomies), zip code (CPT custom field).

Now, search results will display thumbnails for listings (CPT match), taxonomy name (taxonomy match), and thumbnails for listings again (custom field match).
So can I ‘assign’ default search results images for those taxonomies? I prefer a simple static image for each taxonomy for now.
Almost like https://www.daysoutwithkids.com/ do that, if we assume that attraction and location are taxonomies.

And just in case you know the answer 🙂
I might add images and other term meta to taxonomies using Pods – e.g. flag icons and state abbreviations for Regions, some icons for Categories, etc.
Do you know how to make these appear in search results? E.g. a flag icon near country name, state abbreviation after state name, etc?

Also, while I’m here…
Chances are we’ll be adding another CPT – Celebrities, so we’ll end up with two CPTs in search sources.
In that case we’ll want to display a standard image in search results for every CPT (exactly like https://www.daysoutwithkids.com/ if we assume that attraction and location are CPTs).
Is there a neat way to do this?

Thanks!