4th Apr '23
/
2 comments

Filtering Cloneable Meta Box Group by Sub Field Value in Bricks

This Pro tutorial provides the steps to filter the rows of a Meta Box cloneable group to only those that have a date custom field value set to today in Bricks query loop.

Use case: Can be used when setting up a restaurant website where the recipes for only the current day should be shown on single posts.

Step 1

Install Meta Box and its AIO extensions.

Create a field group having a Date Picker type of field.

Step 2

Edit your posts and populate the field group.

In this example, today's date is 4 Apr 2023

Step 3

Edit the single Bricks template for your post type.

Copy this Section's JSON and paste it.

We have selected "MB Group: Post Data" as the Query Type where "Post Data" is the ID of the cloneable group.

Step 4

Add the following in child theme's functions.php or a code snippets plugin:

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
Dynamically Displaying Connected Content Offer Images in Bricks using Meta Box Relationship

Dynamically Displaying Connected Content Offer Images in Bricks using Meta Box Relationship

Consider the following scenario from a recent project I worked on. CPT 1: project CPT 2: content-offer Taxonomy for Projects: remodel-typeSample term names: Backyard Cottages…
Pro
Meta Box Taxonomy Field’s Image Value in Posts

Meta Box Taxonomy Field’s Image Value in Posts

In a project I am currently working on, the requirement is to show the image of an "Image Advanced" type attached to a taxonomy in…
Categories:
Tags:
Pro
Querying Posts by Date/Datetime Custom Fields in Bricks

Querying Posts by Date/Datetime Custom Fields in Bricks

This Pro tutorial shows how to configure ACF and Meta Box to query posts in Bricks by custom field(s) of the type Date/Date Time Picker…
Categories:
Tags:
Pro
Dynamic Source for Video Element in Bricks Using Meta Box Post Field

Dynamic Source for Video Element in Bricks Using Meta Box Post Field

This Pro tutorial provides the steps to set the source of a Bricks video element on single CPT pages to be the URL of a…
Categories:
Pro
Filtering ACF Repeater Bricks Query Loop by Sub Field Value

Filtering ACF Repeater Bricks Query Loop by Sub Field Value

We look into how ACF Repeater rows output by a Bricks query loop can be filtered using the bricks/query/run PHP filter.
Categories: