Let’s say you have a blog, and each post from your blog also contains a grid. And the items for this grid represent all your blog posts. If you want to exclude the current post from this grid, you can add the following PHP snippet to your theme’s “functions.php” file.
add_filter(‘essgrid_query_caching’, ‘eg_disable_chache’, 10, 2);
add_filter(‘essgrid_get_posts’, ‘eg_mod_posts’, 10, 2);
function eg_mod_posts($query, $grid_id){
if($grid_id == 1){
$exclude_id = get_queried_object_id();
$query[‘post__not_in’] = array( $exclude_id );
}
return $query;
}
function eg_disable_chache($do_cache, $grid_id) {
if( $grid_id == 1 ) {
return false;
}
}
In the PHP snippet, for the "grid_id == 1"
parts, this will check to make sure the functionality is only applied to your specific grid.
To get the ID for your grid, visit the plugin’s main admin page where your grids are listed: