Title: Filtering Pods Dynamically
Last modified: July 1, 2022

---

# Filtering Pods Dynamically

 *  Resolved [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/)
 * My template for the main list of pods works great. A main field displayed is 
   a taxonomy (the artist’s name). I have that linked to its respective category
   URL.
 * It’s on this page where I am having difficulty. I want this page to show, using
   the same template, all of the works just by this artist.
 * I’m using this page template:
 * `[pods name="artwork" where="artist.name=name" template="Artist List of Works"]`
 * I have tried various “where” attempts to get this to work. The logic I’m using
   is that the page should dynamically fill in what the artist.name should equal
   based on the page info since this is the actual category URL.
 * Any idea or is there a better way of doing this?

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15789519)
 * After some reasearch, this should theoretically work within the taxonomy item
   page, but it doesn’t:
 * `[pods name="artwork" where="artist = {@artist.name}" limit="20" template="List
   View"][/pods]`
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15789831)
 * I’ve tried:
    {@name} {@post_name} {@post_title}
 * etc etc etc
 * It seems to be something to do with a loop that I can’t step out of to get the
   existing page meta values.
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15790114)
 * Afer more research, I’m leaning toward something like this (I keep changing the
   template name).
 * `[pods name="artwork" where="artist.name = name IN (artist)" limit="20" template
   ="Artist List of Works"]`
 * Still not working yet
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15794120)
 * Hi [@rscarter1](https://wordpress.org/support/users/rscarter1/)
 * Are you using this shortcode in a Pods Template?
    If so, then the object where
   you use this template must have an `artist` field for this to work. If not, then
   magic tags related to an object won’t work since these are only working for Pods
   Templates.
 * However you can do something like this:
 * `[pods field="artist" template="Your Template"]`
 * This will fetch all data from the `artist` field of the current object(page).
 * Cheers, Jory
 *  [Bjarne Oldrup](https://wordpress.org/support/users/oldrup/)
 * (@oldrup)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15794280)
 * Finding out how to query related tables in Pods is hard, but once you get it,
   it works great.
 * I’m working on a similar project, let me try to rewrite the line from my “artist”
   template
 * `[pods name=”works” orderby=”title” where=”rel_works_artist.ID={@ID}” template
   =”list-item”]’
 * The approach is here, within the artist template, to show all “works” pods, ordered
   by title, where a relation between the rel_works_artist, and rel_artist_works
   field is setup.
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15795492)
 * [@keraweb](https://wordpress.org/support/users/keraweb/) [@oldrup](https://wordpress.org/support/users/oldrup/)
 * Thanks for your replies.
 * The shortcode I’m using is on a taxonomy template (using Divi) and not the pods
   template. I call a Pods template though.
 * I have the custom post type post “Artwork” and then several taxonomies one of
   which is “artist” (all created through pods), and I’m building that taxonomy 
   page out.
 * So when I attempt something like this on the taxonomy/page template:
 * `[pods name="artwork" where="artist = {@artist.name}" limit="20" template="List
   View"][/pods]`
 * I’m calling the Artwork pod and trying to filter those artworks that have only
   that artist’s name by trying to pull that artist name dynamically from the taxonomy
   page. So this shortcode above is placed in the WP/DIvi template and then calls
   the artwork pod on this taxonomy page.
 * If I remove the where clause, the template looks great – just not filtered. It
   shows all artworks, of course.
 * Here is the full “list view” template and I use this on my main artwork page:
 *     ```
       <article>
       <div class="container-grid">
       <div class="database_column_one">
       {@post_thumbnail.medium}
       </div><div class="database_column_two_top">
       	<b><u><a href="{@artist.permalink}">{@artist}</a></u></b><p>
       	<b><i>{@post_title}</i></b></div>
       	<div class="database_column_two_bottom">
       	Auction Date<p></p>
       	<b>{@auction_date}</b>
       	</div>
       <div class="database_column_three">
       	Lot Number<p></p>
       	<b>{@lot_number}</b>
       	</div>
       <div class="database_column_four">
       	Hammer Price<p></p>
       	<b>{@currency}{@hammer_price}</b>
       	</div>
       <div class="database_column_five">
       	Buyer<p></p>
       	<b><a href="{@buyer.permalink}">{@buyer}</a></b>
       	</div>
       <div class="database_column_six">
       	Underbidders<p></p>
       	[each underbidders]<b><a href="{@permalink}">{@name}</a></b>[/each]
       	</div><p></p>
   
       								</div>
       <article>
       ```
   
 * In column_two_top, I list that artwork’s artist. ANd I have it linked to that
   respective artist’s URL (a taxonomy term page). It is this page where I am placing
   the shortcode (above) to filter by artist – but not the individual page – but
   a Divi?WP template for all of the ‘artist’ taxonomy terms. And am looking to 
   filter dynamically to list the artwork using the same template.
 * Does this make better sense? I have tried for hours.
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15796227)
 * Progress? Sort of.
 * In my taxnomy Pod called artist, I added a relationship field connected to Artworks
   which is bidirectional.
 * Created a new template just for the taxonomy term page. Template is:
 *     ```
       <article>
       <div class="container-grid">
       <div class="database_column_one">
       {@artworks.post_thumbnail.medium}
       </div><div class="database_column_two_top">
       	<b><u><a href="{@permalink}">{@name}</a></u></b><p>
       	<b><i>{@post_title}</i></b></div>
       	<div class="database_column_two_bottom">
       	Auction Date<p></p>
       	<b>{@artworks.auction_date.name}</b>
       	</div>
       <div class="database_column_three">
       	Lot Number<p></p>
       	<b>{@artworks.lot_number.name}</b>
       	</div>
       <div class="database_column_four">
       	Hammer Price<p></p>
       	<b>{@artworks.currency}{@artworks.hammer_price}</b>
       	</div>
       <div class="database_column_five">
       	Buyer<p></p>
       	<b><a href="{@artworks.buyer.permalink}">{@artworks.buyer.name}</a></b>
       	</div>
       <div class="database_column_six">
       	Underbidders<p></p>
       	[each artworks.underbidders]<b><a href="{@permalink}">{@name}</a></b> [/each]
       	</div><p></p>
   
       								</div>
       <article>
       ```
   
 * And now the shortcode for the term page in the Artist Taxonomy works – soft of(
   I’m calling on the Artist pod now instead of artworks because of the new field
   I added).
 * `[pods name="artist" limit="20" template="Artist List of Works"]`
 * Although the artist taxonomy item only has one connected artwork, the template
   shows the one artwork item PLUS two blank rows for the other two artworks I have
   listed.
 * Getting there – what am I missing? I’m so slow……
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15796235)
 * OMG.
 * I needed the [each] shortcode in the template.
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15796398)
 * And then, it stopped working. Came back to it an hour later, and all the records
   are showing again.
 * Not a clue.
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15797309)
 * After hours of finagling, I found something that works (for now).
 * My page shortcode is changed to reference the taxonomy field (bidirectional related
   to main list of artworks pod) rather than the taxonomy pod itself:
 * `[pods field="artworks" template="Artist List of Works"][/pods]`
 * And the template changed to:
 *     ```
       <article>
       <div class="container-grid">
       <div class="database_column_one">
       {@post_thumbnail.medium}
       </div><div class="database_column_two_top">
       	<b><u><a href="{@artist.permalink}">{@artist.name}</a></u></b><p>
       	<b><i>{@name}</i></b></div>
       	<div class="database_column_two_bottom">
       	Auction Date<p></p>
       	<b>{@auction_date.name}</b>
       	</div>
       <div class="database_column_three">
       	Lot Number<p></p>
       	<b>{@lot_number.name}</b>
       	</div>
       <div class="database_column_four">
       	Hammer Price<p></p>
       	<b>{@currency}{@hammer_price}</b>
       	</div>
       <div class="database_column_five">
       	Buyer<p></p>
       	<b><a href="{@buyer.permalink}">{@buyer.name}</a></b>
       	</div>
       <div class="database_column_six">
       	Underbidders<p></p>
       [each underbidders]<b><a href="{@permalink}">{@name}</a></b>[/each]
       	</div><p></p>
   
       								</div>
       <article>
       ```
   
 * And – it’s working as it should.
    -  This reply was modified 3 years, 11 months ago by [rscarter1](https://wordpress.org/support/users/rscarter1/).
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15797585)
 * Hi [@rscarter1](https://wordpress.org/support/users/rscarter1/)
 * Good to hear you’ve solved it! Your latest post looks good to me as it uses the
   actual field instead of a query as I mentioned here: [https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15794120](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15794120)
 * Cheers, Jory
 *  Thread Starter [rscarter1](https://wordpress.org/support/users/rscarter1/)
 * (@rscarter1)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15798571)
 * [@keraweb](https://wordpress.org/support/users/keraweb/)
    So you did…you know,
   my eyes didn’t catch the field reference. I just didn’t pick up on it.
 *  Plugin Author [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * (@keraweb)
 * [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15798595)
 * Hi [@rscarter1](https://wordpress.org/support/users/rscarter1/)
    No worries, 
   glad you’ve solved it!

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Filtering Pods Dynamically’ 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/)

 * 13 replies
 * 3 participants
 * Last reply from: [Jory Hogeveen](https://wordpress.org/support/users/keraweb/)
 * Last activity: [3 years, 11 months ago](https://wordpress.org/support/topic/filtering-pods-dynamically/#post-15798595)
 * Status: resolved