What happens if you use [pass taxonomy_loop=state_taxonomy]
instead of [pass taxonomy=state_taxonomy]
?
Try:
[for each=state_taxonomy]
[loop type=city taxonomy=state_taxonomy term={TERM} count=12 orderby=rand]
[field title-link]
[/loop]
[/for]
or
[for each=state_taxonomy]
[loop type=city count=12 orderby=rand]
[field title-link]
[/loop]
[/for]
-
This reply was modified 4 years, 3 months ago by
polarracing.
Thanks, everyone. These 2 actually create the same issue, but in 2 different ways. I have 13 possible “states” as the State_Taxonomy. So, in each solution, it’s looping through all 13 and giving me 12 results for each, or a total of 166.
My CPT “city” only has 1 state_taxonomy per entry. So, the desired result is to pass its state_taxonomy to the loop and grab 12 random results that have a matching state_taxonomy.
As an addendum: my original code grabs only 12 results, but those results do not match the state_taxonomy of the CPT City.
-
This reply was modified 4 years, 3 months ago by
aeamarkg.
Then try this:
[for each=state_taxonomy current=true]
[loop type=city count=12 orderby=rand]
[field title-link]
[/loop]
[/for]
Boom! That did it. Many many thanks. Knowing that setting will be a huge help in the future.