Dynamic Content "Term" not working to show category on each post in search results

I’m trying to use {{dc:term:name}} on a custom layout for the search results page.

In the editor it populates just fine:

But when viewing the front-end of the site, it does not:

Hello @SJF_me,

Thanks for writing in! Before you can use the {{dc:term:name}}, you need to run a “Current All Terms” Looper provider first. It is best that you use the “Terms” dynamic content to display the categories of each post.

To better assist you with your issue, kindly provide us access to your site so that we can check your settings. Please create a secure note with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
- Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

Best Regards.

Thank you @ruenel. I’ve added credentials for you on our staging site - feel free to make any changes you would like, as we are not using it for any reason other than support.

As far as adding the looper, I’m unsure if this is the correct solution, because adding a Looper in an Archive template overrides the Query that the Search Results page is trying to propagate, correct?

I say this because I am unable to use a looper provider in any of the parents of the category link text element without breaking the query of the search results itself.

Hi @SJF_me,

Upon checking on your staging area, I suspect that you already figure it out because the terms are now showing on your search result layout.

Thank you.

@marc_a I suspect that you took that screenshot from the Edit Layout page within Pro, correct? You can see in my original post they appear just fine when editing the layout, but not when viewing it on the front-end.

Hello @SJF_me,

I have edited your Search Results layout and added the Terms (Minimal) dynamic element. I have modified the Looper Provider from “All Terms” to “Current Post Terms” so that only the terms of the current post item will be displayed.

Feel free to check and tweak the styling so that it will look the same as your text element.

Awesome, thank you @ruenel! For historical documentation purposes of this forum, I’m going to break this down for anyone else who has trouble with this…

Basically, if you’re using Layouts to create an Archive for Search Results, and are trying to add “category” anywhere in the results, the category’s wrapper needs to be both a Looper Provider and Looper Consumer.

In my case, all I needed to do was add a “div” element and set the Looper as…


…then I just added a “text” element with <a href="{{dc:term:url}}">{{dc:term:name}}</a> set as the text, to show the category name and a link to the category archive.

Easy peasy! :smiley: Thanks again!

1 Like

You are most welcome @SJF_me.

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