If you look at what Pods is doing behind the scenes, it is mainly dealing with meta data, taxonomies, all stuff that lends itself to direct query. The Pod is just a data object that has additoinal information about the type of posts the Pod is attached to, etc.
What I have started doing is just direct querying, since shortcodes tend to not allow complex queries. So I use Pods to facilitate adding custom fields and using them in my posts, but querying using WordPress built in functions.
So say you have a custom post type called ‘my-type’, a taxonomy called ‘my_taxonomy’ with some terms, and you have custom fields associated with the ‘my-type’ post. You can query pretty much anything you want using WordPress’s built in query builder. For instance
$args = array(
‘post_type’ => ‘my-type’
‘order’ => ‘ASC’,
‘meta_query’ => array(
‘relation’ => ‘AND’,
array(
‘key’ => ‘my_custom_field_1’,
‘value’ => ‘SomeVal’,
‘compare’ => ‘=’,
),
array(
‘key’ => ‘my_custom_field_2’,
‘value’ => ‘AnotherVal’,
‘compare’ => ‘>’,
),
),
‘tax_query’ => array(
array(
‘taxonomy’ => ‘my_taxonomy’,
‘field’ => ‘slug’,
‘terms’ => array(‘some_term’,’other_term’),
),
),
)
);
$selection = new WP_Query($args);
From that result you would have count. Notice how this approach lets you specify AND or OR relations, etc. With that tax_query you could also specify a relation type and just add as many arrays as you need with the separate taxonomies. And you can add all sorts of additional info like ‘status’, etc.
So above method is equivalent of telling WordPress “Get all posts of my custom post type (or some standard type), that have custom fields meeting my criteria, and that are attached to taxonomies as I specify.”
Pretty powerful approach. Notice also that you specify compare methods, so not just equal to, but greater than. So if you added a date field to a post via Pods, you can use this querying approach to, say, get your posts whose ‘my_date_field’ is greater than some date.
This might look more complicated than it is. But once you get the hang of it, you might find yourself just building queries for whatever you need.
Viel Spass!
Brian