Layout Builder - include the category in the search results on each item

Hello there,

Is it possible for the category to appear within the item’s link markup? My client would like to place a relevant category icon next to each one.

Kind Regards,

Spencer

Hi Spencer,

Thanks for reaching out.
It is not very clear what your client is trying achieve. Can you please elaborate more, any marked screenshot will help us to recognize the need?

Thanks

Hi @tristup,

Thanks for getting back to me. Apologies for the lack of clarity :-}

My client would like to display an icon next to each search result depending on it’s category. The example they gave me was this: https://g-care.glos.nhs.uk/search/?q=covid

I appreciate that the linked website was not built using Wordpress.

Kind Regards,

Spencer

Hello Spencer,

Are you using the Layout Builder in creating your custom Search Result page layout? You can always insert different Icon elements and then assign each of the icons according to the respective category.

Hope this makes sense. Kindly let us know how it goes.

Hi @ruenel,

Thanks for getting back to me. Yes, I am using the Layout Builder - I’ll report back :slight_smile:

Cheers!

Spencer

Hello Spencer,

Please let us know how it goes for you.

Have a great day!
Thanks

Hi @prakash_s

I had to change what the client wanted, as usual!

I played around and on the result page I used Dynamic Content to add a class displaying the category using {{dc:post:post_type}}. This worked perfectly, but my client now wants to display an icon for the post format itself - some of their posts will simply be a PDF to download and some will be text articles.

Is this possible?

I can see the option to add post formats in the conditions but not how to add this format as a class.

Kind Regards,

Spencer

Hi Spencer,

Thanks for reaching out.
I would suggest you add the icons with the **condition for the specific Post Format. The condition will be Post Format is Image to show the icon for the image post format.

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.