Creating a custom query in WP Query Generator
Step 1 – First of all, we should open the WP Query Generator tool and start setting the needed parameters for creating a custom query.
Step 2 – We need to specify the post type slug, which is Post in our case.
Step 3 – In Post status field we can select what posts to display (such as publish, pending, draft, etc.). We want to show published posts, so we have chosen the Publish option.
Step 4 – Then we designate the ASC order parameter the queried posts will be showcased in the ascending order.
Step 5 – Last but not least, we specify the Order by parameter, such as Name to order the posts by their names.
Step 6 – When all parameters are set, we can see the generated query below. It can be copied in JSON or PHP format. We click Copy to Clipboard button and proceed with customizing the Posts widget in Elementor.
There are a lot of varied parameters, which can be set according to your needs and purposes. You can learn more about the provided parameters here.
Adding a custom query to the Posts widget
Step 1 – In Elementor editor we open the page, where we use the Posts widget and click Edit Posts button.
Step 2 – On the left, we see the panel with various settings for the widget. In the Content tab, we find the Custom Query subsection and enable Use Custom Query option moving the toggle.
Step 3 – After that, we input the generated query in the field below.
Step 4 – Everything is done. Now the posts are displayed in the adjusted order using custom query method.
Try to use a custom query in the JetElements Posts widget and you will be impressed by how useful and easy it is.