Title: Each Loop tag
Last modified: May 12, 2024

---

# Each Loop tag

 *  Resolved [craftylion](https://wordpress.org/support/users/cjmclean/)
 * (@cjmclean)
 * [2 years ago](https://wordpress.org/support/topic/each-loop-tag/)
 * I’m trying to create a loop which only shows posts associated with a certain 
   taxonomy called “Nature”.
 *     ```wp-block-code
       [each nature]
       <li> 
       {@post_title}
       <audio src="{@file._src}">{@file.src.full}</audio></li>
       [/each]
       <audio src="{@file._src}"></audio>
       ```
   
 * However, the result ends up with a blank page. What I’m I doing wrong?

Viewing 1 replies (of 1 total)

 *  Plugin Support [pdclark](https://wordpress.org/support/users/pdclark/)
 * (@pdclark)
 * [2 years ago](https://wordpress.org/support/topic/each-loop-tag/#post-17790630)
 * `[each]` would loop over posts referenced in a relationship field associated 
   with the current post object, depending on what is being queried by the wrapping
   block or shortcode.
 * To loop over all posts associated with taxonomy nature, assuming the association
   is made with the `Connections` tab, one would use a `where` query in a `Pods 
   Item List` block or shortcode.
 * The `where` query would be `nature.slug IS NOT NULL` to get all posts associated
   with any term within the taxonomy `nature`.
 * If the post type being queried is `post` and the template is named `Example Template`,
   the shortcode version would be:
 *     ```wp-block-code
       [pods name="post" template="Example Template" where="nature.slug IS NOT NULL"]
       ```
   
 * This is the same as writing the template within the shortcode or template field
   in the block, then not naming a specific template:
 *     ```wp-block-code
       [pods name="post" where="nature.slug IS NOT NULL"]
           {@post_title}<br/>
       [/pods]
       ```
   
 * The general idea is that the initial query loop is initiated by the shortcode
   or block, then the template is called for each item found by that query. This
   differs from `[each]` in that `[each]` runs a sub-loop on related posts within
   a field on the current object in the main loop.
 * If there is a field or taxonomy connection called `nature` on a post, `[each]`
   would loop through the associated terms, rather than posts associated with those
   terms.
 * If there is a relationship field called `nature` on `post` relating to other 
   posts or another post type, `[each]` would loop through those related posts within
   the field on the currently queried post.
 * So to loop through posts associated with a taxonomy, one would likely use the`
   where` attribute on the main shortcode or block, rather than `[each]`.

Viewing 1 replies (of 1 total)

The topic ‘Each Loop tag’ is closed to new replies.

 * ![](https://ps.w.org/pods/assets/icon.svg?rev=3286397)
 * [Pods - Custom Content Types and Fields](https://wordpress.org/plugins/pods/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/pods/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/pods/)
 * [Active Topics](https://wordpress.org/support/plugin/pods/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/pods/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/pods/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [pdclark](https://wordpress.org/support/users/pdclark/)
 * Last activity: [2 years ago](https://wordpress.org/support/topic/each-loop-tag/#post-17790630)
 * Status: resolved