How to Filter the Posts Using the Custom Fields Values
Read about the way of filtering the posts using the custom field values which are set up in WordPress Dashboard for the correct work of JetBlog plugin possibilities.
Before you start check tutorial requirements:
- Elementor (Free version);
- JetBlog plugin installed and activated.
When you’ve already got a wide range of posts, sometimes you might want to display only the ones that contain the specific information. This can be accomplished using categories, but this won’t help to query the posts by specific values. In order to accomplish such a feat, you’d need to use the special functionality of JetBlog widgets allowing to filter the posts using the values from the meta fields. Let’s explore further how this can be done.
Remind you that we described the custom fields with mentioning all the details in this article .
Now let’s talk more specifically about the filter function for the posts with the use of custom fields values.
Settings in WP Dashboard
Navigate to the WP Dashboard. Choose here Posts > All posts option. Choose the one you want to edit and click the corresponding link below.
Click on the settings button on the right corner of the page.
In the following screen tick the Custom Fields option.
Adding custom fields
Scroll the page until you reach the Custom Field block.
Below you will see the block with the name Add New Custom Field. In the dropdown choose the Name and add the Value the post to be shown.
To add the value you need to go to the phpMyAdmin tool, navigate to the current database. Then you should select the wp_postmeta table and look for the meta_key field to choose the appropriate key.
Note that there are multiple values that make it possible to select more than one value a once. Default values are applied if nothing else was chosen.
Query & Control settings
Go ahead to the Elementor editor where you have to open your work canvas with involved widgets, such as Smart Posts list or Posts Tiles.
Secondly, you should choose the needed section and proceed to the Content > Query & Control tab.
Toggle on the Filter by Custom Fields option.
In the Custom Fields Key field you have to add the correspondent key from the database in phpMyAdmin.
The next field is Custom Fields Value where you can query the posts using the specific value from the meta field.
Below you are able to turn on the filter by Terms: Categories, etc.
Tht’s all about filterig the posts using the custom fields values.