Posts Ordered By a Date Field in Bricks

Posts Ordered By a Date Field in Bricks

The Query interface available in the Posts element and the Query Loop feature of Bricks enables us to order items of any post type by the value of a date-type of custom field.

Here’s a sample screenshot of this out-of-the-box option:

Here we are telling Bricks to ask WordPress to fetch the latest 10 (this is the number set at Settings → Reading → Blog pages show at most) posts of a workshop Custom Post Type with the items (posts) ordered in ascending order of the value of a workshop_date custom field that is of Date-type.

Note that this will output only the posts that have the custom field populated.

Get access to all 526 Bricks code tutorials with BricksLabs Pro

Leave the first comment

 

Related Tutorials..