4th Aug '23
/
4 comments

Sorting Relationship Query Results in Bricks

This Pro tutorial show how bricks/query/result filter in Bricks builder can be used to sort the results of a ACF (should also work with Meta Box) Relationship query in

  • ascending order of post title
  • descending order of post title
  • ascending order of post date
  • descending order of post date

By default the results will be in the order the related posts are arranged (on the right side of the screenshot below) for a post. These can be manually dragged and dropped around in the desired order.

Step 1

Install and activate ACF Pro.

Step 2

Create two CPTs say, service and faq.

Create a field group named Service FAQ Relationship Group.

We have created a single field group that will appear when the entries of either CPTs are edited.

Step 3

This step is not needed in ACF Pro v6.2 and above.

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 626 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Pro
ACF Post Object Query Loop inside a Posts Query Loop in Bricks

ACF Post Object Query Loop inside a Posts Query Loop in Bricks

How to loop through a CPT and within each post, output a list of related posts.
Categories:
ACF Relationship: Count of Related Posts

ACF Relationship: Count of Related Posts

Looking to get the number of CPT B posts related to a CPT A post when using a Relationship field with ACF? Here's a custom…
Categories:
Tags:
Pro
Filtering Meta Box Cloneable Group by Select Subfield for Multiple Bricks Query Loops with Conditional Output

Filtering Meta Box Cloneable Group by Select Subfield for Multiple Bricks Query Loops with Conditional Output

In the Bricks Facebook group a user asks: Consider this cloneable Meta Box field group for a Custom Post Type called Tour: with the Tour…
Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories:
Pro
Category Grid with ACF Images in Bricks

Category Grid with ACF Images in Bricks

Creating a grid of post categories, each category card showing an image from an ACF field, category name & description.
Categories: