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
Step 1 – Navigate to the WP Dashboard. Choose here Posts > All posts option. Choose the one you want to edit and click the corresponding link below.
Step 2 – Now you should click on the settings button on the right corner of the page.
Step 3 – In the following screen tick the Custom Fields option.
Step 4 – Then you should scroll the page until you reach the Custom Field block.
Step 5 – 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.
Step 6 – 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 an once. Default values are applied if nothing else was chosen.
Step 1 – 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.
Step 2 – Secondly, you should choose the needed section and proceed to the Content > Query & Control tab.
Step 3 – Then toggle on the Filter by Custom Fields option.
Step 4 – In the Custom Fields Key field you have to add the correspondent key from the database in phpMyAdmin.
Step 5 – The next field is Custom Fields Value where you can query the posts using the specific value from the meta field.
Step 6 – Below you are able to turn on the filter by Terms: Categories, etc.
Here you are! It’s as easy as ABC.
Enjoy the result!