Radio Websites:
Using the WP_Posts Query

Our Radio Website Platform has a great selection of custom blocks. One of these – the Post Grid Block – allows you to feature content on your website using custom criteria. This article explains how to adjust this criteria.

The Post Grid Block looks like this:

When you use the ‘Post Grid’ block, you can specify a special option to define which posts end up in the resulting grid. This special syntax is in-built into WordPress and called ‘WP_Posts Query’.

By default, a blank WP_Query will simply select the most recent Posts on your website. However, we can manually add settings to define how posts are automatically selected.

Some example queries:

  • Display posts from a specific category:
    category_name=station-news
  • Display posts from two categories:
    category_name=station-news,andrew-blog
  • Display posts from a tag:
    tag=anthony-opinions
  • Display pages:
    post_type=page
  • Change the quantity:
    posts_per_page=6
  • Re-order the posts:
    order=ASC&orderby=date

Of course, these options can be combined to form more advanced queries. Here are some further examples:

  • Display six most recent posts from the ‘station-news’ category:
    category_name=station-news&posts_per_page=6&order=ASC&orderby=date
  • Display three most recent posts from the ‘breakfast-show’ tag:
    tag=breakfast-show&posts_per_page=3& order=ASC&orderby=date
  • Display six random posts from the ‘recipes’ category:
    category_name= recipes&posts_per_page=6&order=RAND

You can even use WP_Query syntax to specific exact pages:

  • Display Pages with IDs 168, 292 and 613, and order them in that specific order
    post_type=page&post__in=268,292,613&orderby=post__in
  • Display both Pages and Donation Pages with specific IDs
    post_type=page,ff_donate&post__in=6,40,41,54&orderby=post__in

If you wish to display a post manually, without any automatic selection logic, you can use the ‘Card’ block. This block allows you to display a single post or page by manually selecting the title. You can combine this with the ‘Columns’ block to create custom grid layouts.

It is also worth noting that if you have multiple ‘Post Grid’ blocks on the same page, each post will only be displayed once – the system automatically de-duplicates posts so you don’t have to manually do this.

Get the Broadcast Technology Newsletter

Sign up for the email newsletter about media and technology. Sent irregularly. No spam.