Stand with Ukraine. Fight for freedom and democracy

Troubleshooting //
Cannot Output the Most Popular Posts via Listing Grid & Order Them

Cannot Output the Most Popular Posts via Listing Grid & Order Them


I cannot order the most popular posts in a listing grid (using the Data Stores module)


Before we proceed to the actual troubleshooting, there’s a little disclaimer to be made. 

Let’s imagine a situation that you have created a Data Store, say Favorites, using the JetEngine functionalities. You want to show which posts the users liked the most and added them more often to their Favorites data store. Committed to that, you wish to output the most popular posts in a Listing Grid in descending order.

In your data store settings, you pick the “User Metadata” Store type (because what else needs to be picked if you are willing to collect data from real users?). In fact, such a Store type might not be a good option if you do not let users register at your website. 

To make it all work smoothly, make sure to choose between these two Store types – “Cookies” and “Session”. “User Metadata” can backfire when the signup is not allowed, while “Local Storage” is totally served by the browser, without the back-end, so it cannot be countable.

possible store types for favorites datastore

Now, let’s get to business. 

Create a new Listing for the most liked posts and style it up in Elementor. 

new listing item styling

Go to the website page, where you want to place the Listing Grid.

Open this page in the Elementor page builder and find the Listing Grid widget in the left sidebar. Drag and drop it to the desired page area and select the Listing you’ve just created in the Listing drop-down select. 

Configure the Posts Query section.

So far, the path to displaying the most liked posts from Data Stores in the Listing Grid is thorny. To make it happen, you are supposed to set up the Posts Query correctly.

posts query section setup

Add a new “order & offset” query item and select the Order & Offset query type. Go with DESC Order – this option will output the posts from the most liked ones to those least liked. In the Order by option, select “Meta Value”. Then paste the following into the Meta key to order field: 


Where you need to replace your-store-slug with your actual Data Store slug. Just copy it from the JetEngine Dashboard. 

copying the favorites data store slug

Lastly, you need to select the “NUMERIC” option in the Meta type drop-down. The final result should be looking like that:

Save the changes by updating the page.

NOTE. You can configure this very query item using JetEngine’s separate module – Query Builder

Go to JetEngine > Query Builder > Add New.

Name it and select the “Posts Query” option in the Query Type drop-down. Then set up the Posts Query settings. In the General tab, specify the Post Type and Post Status.  

posts query setup in the query builder

Click on the “Add new sorting parameter” button and configure it as follows:

  • Order By. In this drop-down select, pick the “Order by numeric meta value” option;
  • Meta key. Paste here jet_engine_store_count_your-store-slug just replace your-store-slug with an actual store slug;
  • Order. Select here the option called “From highest to lowest values (3, 2, 1; c, b, a)”.

Press the “Add Query” button and proceed to display the query on the page.

The only problem with such a setup is that the Listing will return only posts added into stores at least once, but this is due to the WP Query logic. This issue is to be resolved in the future. 

Moreover, you should acknowledge that this functionality is not fully protected from some cheating. For example, the same user can like the same post from different browsers or devices, as well as under the incognito mode. Each time a new count will be added to the Data Store stats. 

Was this article helpful?
Still need help?
Submit a request