Unable to set if logic with Term attribute


<If term="value" exists>

Hello there!

There is this docs How-to guide that might be helpful in what you want to do.

Basically you would have to do something like this:

<If loop type=taxonomy_term taxonomy=category include="term-name" post=current>
  Conditionally display this stuff

Let me know if this helps!

@emma Thank you for the reply. It’s not working for me.

I want to add if logic on the archive template.

Hi Shankar!
Are you trying to check against the term metadata of the current term archive? Here’s documentation on how to get archive meta on type, term and author archives: Getting metadata from the current archive | Loops & Logic

Essentially, the default loop context on any archive is the posts that apply to it. To get information about the current term, you need to use the provided field loop. From within this loop you can use any fields supported by the taxonomy_term loop or get data from custom fields applied to the term.

<Loop field=archive_term>
  <If field=name value="value">Content</If>

If this wasn’t what you were trying to do, could you provide a bit more context about your desired outcome?

@julia With this I’m able to get current archive fields. But, unable to fetch pods custom fields or rankmath custom fields. Unless I also install and active ACF plugin.