Targeting Taxonomy Archives of a specific term and child terms

Hello,

I wanted to share a L&L template to insert data in the Taxonomy Archives of a specific term and its child terms.

<Loop field=archive_term> <!-- Return current Taxonomy Archive term --> 
  
  <Set logic=complex_condition any=true>
    <If field="slug" value="my-term">true<Else />false</If> <!-- Check if term matches the specified -->
    <Loop field=ancestors> <!-- For child terms: return parent term -->
      <If field="slug" value="my-term">true<Else />false</If> <!-- Check if parent term matches the specified -->
    </Loop>
  </Set>
  
  <If logic=complex_condition>
    <h3>This is 'my-term' Taxonomy Archive or one of its child terms</h3>
  <Else />
    <h3>Not in the specific Taxonomy Archives</h3>
  </If>
  
</Loop>
2 Likes