Getwid meta fields

Apply Custom Filters to Post Blocks since Getwid Plugin 1.7.1

Home > Blog > Product updates > Apply Custom Filters to Post Blocks since Getwid Plugin 1.7.1

The focal point of the Getwid 1.7.1 update is Custom Field Filter added to the Custom post type, Post slider, and Post carousel blocks. It allows you to apply advanced custom filtering to the posts displayed on the site.

You can find this new instrument in the Sorting and Filtering section of the block customization panel: Content Settings > Sorting & filtering.

content filtering 1custom filed filter

The Custom Field Filter button triggers Meta Query Builder – a tool that allows you to add and apply custom filters to the Getwid block you’re editing.

What is a meta query, by the way? In simple terms, it’s a term, a piece of data that allows for some sort of categorization. There is default WordPress term categorization for blocks – and you can extend it by adding more filters.

Where can you employ it?

In the context of this Getwid update, meta query is a helper that allows you to display posts in Getwid post blocks by extra custom filters. These custom filters are usually sourced by third-party plugins you might use: Advanced Custom Fields, WooCommerce, etc. Posts provided by these extra plugins are custom post types you choose in the Content Settings of Getwid blocks:

custom post types

In the example of the Post carousel block above, posts and pages are regular WordPress post types, while Products (sourced by WooCommerce), Accommodation types and Services (sourced by Hotel Booking), and Testimonials (sourced by another installed plugin) are custom post types. A list of post types you see depends on the plugins activated on your WordPress site.

Some custom post types may lack filtering opportunities – this is where the Getwid WP Meta Query Builder comes into play.

For example, in order to organize WooCommerce products in a Getwid Post carousel block by extra parameters, you firstly need to add these parameters via Meta Query Builder.

How the Meta Query Builder works

The Meta Query Builder by Getwid transforms custom fields of the third-party plugins into meta queries and allows you to apply conditional filtering rules to these queries.

It works by adding conditional logic rules via the Meta Query Builder.

meta qury builder getwid

AND or OR relation

AND applies to all suitable meta field values

OR – applies to values of only one parameter

Key and values

Meta key is the required field – it’s a parameter you’ll be organizing your posts by. You also need to paste custom value related to the key.

meta query key

Where do you get it?

It always depends on what plugins you are working with. Each plugin will have its docs for this sort of functionality and you’ll need to add meta fields in different ways; some plugins don’t offer this opportunity at all. Some plugins require extra plugins for adding custom fields. Whether to use this new tool depends on what sort of plugins you use and what sort of filters you want to apply to Getwid post-related blocks (we’ll show how it works in the next part of the post).

You can also create unlimited groups that can combine different keys and values.

Types and functions

To learn more about the conditional rules you can apply to your posts, refer to the WP Meta  Query Guide.

Use case with ACF

Let’s illustrate it with an example. I’m taking the easy way.

I’m going to use the Advanced Custom Fields plugin to add custom fields to my Services post type sourced by the Hotel Booking plugin.

The ACF is extremely simple at this aspect – since you can quickly add meta fields and their values that can be further used as meta queries by the Getwid Meta Query Builder.

For example, I’m a hotel owner and want to build a slideshow that will display only season-wise services or activities offered in my hotel. So that winter travelers are not met with the summer rafting tours when they land on my website!

There are around 40 services in my database and I want to categorize them by seasons and display only summer-related services in my slideshow in the summer period.

First, I need to create custom ACF meta fields for this.

season in post blocks custom fields

And make it appear under each service:

service rule

I also need to add choices:

choices in post blocks custom fields

Let’s publish the whole staff to save the changes.

Let’s see what I can now add to the service – I need to go to each service and tick the needed box:

meta fields

Then I get back to the Carousel post block by Getwid and Meta Query Builder. Here I can use the name of the ACF field name as a meta key:

season summer

There can be more filters, for example, summer discounts. If I add such a field via the ACF plugin, I can also apply it here in my conditional rules in the Meta Query Builder.

two rules buidler

Make sure to check that the key and its values are the same as the names of meta fields. You can also create a group of parameters that combines different keys and values.

In a result, thanks to the advanced filtering options of Custom Field Filter, I get a slider of services that shows only summer offerings!

slideshow meta fields

Furthermore, you can also add several values for one key, e.g. show summer and spring activities in one slider:

extra values 

Or, the between function will help you output posts of some range.

It might also take some time to learn about the conditional logic rules that you can apply: WP Meta  Query Guide

This is a very simple example! Most likely if you run massive websites with different conditional rules, you can apply advanced filtering in any preferable way. We hope Getwid WordPress Blocks will assist you well in this task!


What Getwid blocks can I use Meta Query Builder for?

You can use it via the Custom Field Filter tool available in the Custom post type, Post slider, and Post carousel Getwid blocks.

Do all third-party plugins support custom fields?

No, it might be a daunting task to figure our how custom fields of specific plugins work and whether they exist at all. But it’s easy to extend any plugin with custom fields using the ACF plugin.

How does the Meta Query Builder work?

The Meta Query Builder by Getwid transforms custom fields of the third-party plugins into meta queries and allows you to apply conditional filtering rules to these queries.

Was this article helpful?

Yes (1) No

You have already left your review.

6 Replies to “Apply Custom Filters to Post Blocks since Getwid Plugin 1.7.1”

  1. Hello!

    Is it possible to add dynamic content to value?

    If I need to compare a ACF relationship field to the current ID, using something like doesn’t work.

    It would be great to be able to use the current queried object ID as value on filtering, so it would be easier to create dynamic content blocks.


Leave a Reply

Your email address will not be published. Required fields are marked *