Pods Shortcode Examples

A fairly sophisticated example of displaying multiple items of a Pods Custom Post Type using a specific Pods Template, and styling accordingly:

Syntax (to go between square brackets):

pods name=”testimonial” select”*” where=”post_tag.slug = ‘touchpoint'” template=”Testimonial Pods Template”

Which Produces:

A 5-star service

Customer service has always been first-class, always helpful and reliable. Highly recommended. We’re huge fans of the TouchPoint software!

Fantastic company to deal with

18 months ago we decided to shop around to see if we could get a better deal on a rental contract for a cash register, we were amazed at how much we could save a month when we contacted Fictional Epos. We found them to be extremely efficient and reliable and the young man that we deal with is friendly and helpful and nothing is too much trouble – I would strongly recommend this company – and the TouchPoint Till!


So, in this instance, we’re explicitly querying the testimonials post type for ONLY those entries tagged ‘TouchPoint’ – very useful for ‘related testimonials’ dynamically appearing on a software product page! And all done via the Pods Shortcode wizard in the page editor for this or any other page!

I chose this particular example because the select/where clause is the hardest bit of the syntax to figure out, and so that you realise that when you’re extending a custom post type to include all the capabilities of a page etc, the default WordPress field types also gain the extra capabilities that Pods affords to each field. ie, post_tag.slug is a thing.

Which is why I’ve let each and every custom post type share the same default Category and Tag taxonomies. Use them to make your life far easier when querying dynamic content! If a Case Study raves about TouchTakeaway… tag it as such! And dynamically display it as a ‘related Case Study’ on a Touchtakeaway product page or a Sectors > QSRs page!

Note there’s enough flexibility with each named div or span to be able to inject content :before and :after the element, as we have with the single and double quotes here for the title and quote content, this being one of the major advantages of combining Pods templating with our visual element templating for extremely fine grained control over the output.

Note also that as a further example of how useful that can be, if you break open the code inspector, you’ll see that each testimonial is correctly marked up as a separate <article> complete with it’s own <header>, <section> and <footer> elements, which allows Google to understand the context of this as a self-contained composition in a broader document. Essentially, you can automate high level SEO in your Pods Templates.


For info on the format and syntax of shortcodes, look here… but then again, as I already said, the Pods Shortcode button in the editor pretty much handholds you through a wizard!