Hi,
I am working on portfolio website where I want related projects to show on each portfolio page. I achieved that by creating essential grids with selected categories. Now, I want to exclude the current post from that related post list. I searched for the code online and did that. It works perfectly for single grid but I want to do that for multiple grids as there may be different categories.
I added the following code in functions.php
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 == 2){
$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 == 2) {
return false;
}
}
How do i change the code to include multiple grid ids in this code … if( $grid_id == 2)
Regards,
Amit
