Problem with using a loop inside a for/each
-
Hi Eliot,
I need some help to using a loop inside a for/each shortcode.
I will try to explain you what i want to do exactly. I have create a custom post type and a taxonomy with parent and child. I have 4 parents taxonomies and some children associated. That what i want to do is display all the children associate to a parent. For that, i use the template archive.php (by the way, did you think it’s better to use a taxonomy.php template instead ?)
That the code i use (inside the wordpress loop)
[..] <?php /* Start the Loop */ ?> <?php start_short(); ?> [for each=my_taxonomy current=true exclude=64,66,70,79] Category: [each name]<br /> [loop type=my_cpt] [field title]<br /> [/loop] [/for] <?php end_short(); ?> <?php while ( have_posts() ) : the_post(); ?> [..]
I succeed to display the title for each cpt, but when two cpts have the same taxonomy, instead of to have this:
Category: my taxonomy
CPT 1
CPT 2I have this:
Category: my taxonomy
CPT 1
CPT 2
Category: my taxonomy
CPT 1
CPT 2It creates doubloon.
If i use it before the wordpress loop, i don’t have doubloon anymore but i can’t display all the taxonomies, just one of them.I’m pretty lost…
I hope i’m clear. Do not hesitate ask me for some other explanations.
Thanks again.
Best regards
- The topic ‘Problem with using a loop inside a for/each’ is closed to new replies.