The Worlds Most Powerful
WordPress Builder

If you Purchased & Registered a Slider Revolution License you can comfortably upgrade version 5.x to 6.0 from your WordPress Dashboard.

Why Activate Slider Revolution?

Activating Slider Revolution with your Personal Purchase Code will unlock all available Features.

Easy Live Updates
Personal License Key
200+ Template Library
1000+ Object Library
25+ Amazing Add-Ons
1on1 Ticket Support

*Regular License from $29. One License Key required per Domain.

Slider Revolution 6.0 NOW available!

Apply advanced post queries using one of Essential Grid's built-in plugin filters.

Careful

This article requires PHP file editing, and therefor is meant for advanced usage only.

Using the following code snippet, you can modify the post query used for your grid's post source.

// code can be added to your themes functions.php file
 
add_filter('essgrid_query_caching', 'eg_stop_caching', 10, 2);
add_filter('essgrid_get_posts', 'eg_mod_query', 10, 2);
 
// turn off caching for your grid
function eg_stop_caching($do_cache, $grid_id) {
 
if($grid_id == YOUR_GRID_ID) return false;
return true;
 
}
 
function eg_mod_query($query, $grid_id){
 
if($grid_id == YOUR_GRID_ID) {
//modify $query to your likings
}
 
return $query;
 
}

In the following example, where posts represent “events” that have a start and end date, we could use the filter to only show events from the past, or even better, only show events that are scheduled to happen in the future.

// code can be added to your themes functions.php file
 
add_filter('essgrid_query_caching', 'eg_stop_caching', 10, 2);
add_filter('essgrid_get_posts', 'eg_mod_query', 10, 2);
 
// turn off caching for your grid
function eg_stop_caching($do_cache, $grid_id) {
 
if($grid_id == YOUR_GRID_ID) return false;
return true;
 
}
 
function eg_mod_query($query, $grid_id){
 
// show only upcoming events in the future
if($grid_id == 36){
 
$query['meta_query'] = array( 'key' => '_start_ts', 'value' => current_time('timestamp'),
'compare' => '>=', 'type'=>'numeric' );
$query['meta_key'] = '_start_ts';
$query['meta_value'] = current_time('timestamp');
$query['meta_value_num'] = current_time('timestamp');
$query['meta_compare'] = '>=';
 
}
 
// show only events from the past
if($grid_id == 50){
 
$query['meta_query'] = array( 'key' => '_start_ts', 'value' => current_time('timestamp'),
'compare' => '<=', 'type'=>'numeric' );
$query['meta_key'] = '_start_ts';
$query['meta_value'] = current_time('timestamp');
$query['meta_value_num'] = current_time('timestamp');
$query['meta_compare'] = '<=';
 
}
 
return $query;
 
}

Popular Solutions