Condition for dynamic data added to a specific CPT term is that possible?

Hi,

I have the following setup.

  1. ACF Custom Post Type “Organizations” features a Taxonomy named “Client Groups.”
  2. “Client Groups” have some terms: kids, amateurs, professionals.
  3. Organization’s Field Group has a specific Group Field aimed at collecting age range data purely for the ‘kids’ term.

I want to dynamically add an age range to the ‘kids’ term output, as it varies between organizations. It should look something like this:

kids (8-12 years) amateurs professionals

My layout structure:

Archive page dedicated to the Organizations Custom Post Type.
–> DIV, serving as the Looper Provider for the Client Group Taxonomy.
–> --> Nested DIV, surving as Looper Consumer and some additional styles for Client Group Terms.
–> --> Nested DIV, surving as Looper Proveder and Consumer for start_age and end_age combined text string.

I need to set a proper condition to show or hide the last nested DIV (for age range) within the parent DIV for Client Group Terms, but only for the ‘Kids’ term. No matter what I try, the age range is also displayed for other Client Groups Terms when more than one is selected.

Screenshot

Hello John,

Thank you for the very detailed post information. You can add a condition to show/hide the Age group by checking the term slug if it is returning “kids”:

image

The element structure might be this:

Client Groups
   Grouped terms
      Div {where you apply {{ term.slug }} is kids } condition
         Age Group
            Display Age

Hope this helps.

1 Like

Thanks @ruenel,

I didn’t think that I needed to make a parent DIV to make it work. :+1: I used the same container of the terms to set up the condition.

You are most welcome, John.

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