Query Loops

Post Types

The name after query: decides which WordPress post type TemplateX asks for.

Posts And Pages#

php
{{ query:posts }}  <h2>{{ title }}</h2>{{ /query:posts }}{{ query:pages }}  <h2>{{ title }}</h2>{{ /query:pages }}{{ query:post }}  <h2>{{ title }}</h2>{{ /query:post }}{{ query:page }}  <h2>{{ title }}</h2>{{ /query:page }}

query:posts and query:post map to the WordPress post type. query:pages and query:page map to page.

Custom Post Types#

Use the custom post type slug:

php
{{ query:project }}  <h2>{{ title }}</h2>{{ /query:project }}{{ query:event }}  <h2>{{ title }}</h2>{{ /query:event }}

The same values still work inside the loop, such as {{ title }}, {{ url }}, {{ excerpt }}, and {{ date }}.

Explicit Form#

If a post type name would be unclear, use query:post_type:{slug}:

php
{{ query:post_type:event }}  <h2>{{ title }}</h2>{{ /query:post_type:event }}

Most of the time, the shorter query:event form is enough.