Allows you to get posts (ie. make a loop) and format them either using your own HTML, or a predefined template. Supports the same arguments as the WP Query class + a few others.

Usage


[query argument1="value" argument2="value" ... template="teaser"][/query]

or:

[query argument1="value" argument2="value" ...]
  <!-- Your own HTML template -->
[/query]

Valid arguments

Other valid arguments, besides the ones from WP_Query are:

template

If present, forces output trough the theme template you specify, for example teaser (teaser.php).

content_limit

Limit the content to this number of words (only relevant if {CONTENT} is used); defaults to 40 words

thumbnail_size

Sets the thumbnail size for {THUMBNAIL}

date_mode

Set the date mode for {DATE}. Can be “relative” or a date format string

featured

Get only posts that are marked as “featured” in the dashboard

Valid Atom keywords

{URL}

Post permalink.

{TITLE}

Title of the post.

{AUTHOR}

Name of the post’s author

{AUTHOR_URL}

URL to the author’s posts page (Author archive).

{DATE}

Post date.

{THUMBNAIL}

Thumbnail image.

{TAGS}

Tags, comma-separated

{CATEGORIES}

Categories, comma-separated

{COMMENT_COUNT}

Number of comments that the post has.

{CURRENT_POST}

Index of the current post (item number in the list)

Example

This example demonstrates custom formatting trough the editor.

Back – end (editor):

HTML preview:

[query posts_per_page=5 orderby="comment_count" order="DESC" content_limit="20"]
  <header>
    <h2><a href="{URL}">{TITLE}</a></h2>
    <p><strong>({COMMENT_COUNT} comments)</strong></p>
  </header>
  <article>
    {CONTENT}
  </article>
[/query]

Result (Front – end):