Support » Plugin: Pods - Custom Content Types and Fields » Query and present data from a pod based on one field's value?

  • Resolved SlazSlackrabbit


    I’m currently building a new WP site as a request from a friend who’s making ‘let’s play’ videos on YouTube. He wants a ‘game database’ that allows him to easely add & link new games by filling a form. And for that reason I’ve choosen Pods as the plugin of choice. However, it’s the first time I’m using WP for anything outside of it’s ordinary functions.

    So first I’ve created a Custom Content Type pod called ‘game’, and added all the fields I require.

    Next, I enabled Templates and created a new template that’ll display all pod fields from ‘game’ in a desired page layout. Works nice!

    Now I only need to create pages listing the content created with the pod ‘game’ based on certain criteria. I have a Relationship Field called ‘platforms’ containing a multiple choice list of game systems, and would like to use this field’s values for sorting.

    I basically need, for example, a page listing links to all ‘game’ posts that have their ‘platforms’ value set to ‘PS3’. Listing them using titles and clickable image links out of their respective pod items. I’ve tried something like this:

    [pods name="game" limit="50" where="t.platforms = 'PS3'"]<a href="./game/{@slug}" alt="Geen link gevonden" title="{@title}"><img src="{@boxart}" alt="{@title}"></a>[/pods]

    But all it does is generate a mySQL error for the ‘where’ tag. Everything I tried to enter in the where box results in a mySQL error.

    I’m sorry if this all seemed vague, I’m not much of a troubleshooter. But what is the easiest method for querying data out of a Pod and presenting it on a page?

    Thanks in advance!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Contributor Josh Pollock


    You are very close to what you need. The where clause in your shortcode is not correct through. If you look at the chart at the bottom of this page you will see that for a post type with a custom defined list it should be in the form “related_field_name.meta_value”. In your case “games.meta_value” should work.

    Thank you Josh! I read through the doc you linked and was able to correct the where clause and create all the functional pages I wanted!

    Thanks a lot, this plugin will save my friend hours of manual editing!


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Query and present data from a pod based on one field's value?’ is closed to new replies.