Hello Team
I am looking to use essential grid to showcase the author’s posts on their profile page on our runner.noble-pro.com site. We use the ultimate members plugin which allows you to edit users profile templates and enables us to identify the user profile using um_profile_id. The idea is to identify the profile_id and use this as the author_id with the Essential Grid’s built-in plugin filters to only show the posts by the author on their profile page.
I have successfully got the profile_id (author_id) using the um_profile_id however I have been unsuccessful getting the “apply advanced post queries using one of Essential Grid’s built-in plugin filters” to only show the post from the relevant author on their profile page.
I have added the following to the function.php file:
/* Ess Grid Profile Posts filter */
$profile_id = um_profile_id();
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 == 6){
$query['meta_query'] = array( 'author' == 32 );
/*
*https://www.themepunch.com/faq/advanced-additional-parameters/
*/
}
return $query;
}
Added the following to the profile.php:
<?php
// Ess. Grid shortcode is placed inside the "do_shortcode" method, wrapped in single quotes
echo do_shortcode('[ess_grid alias="profile_posts"]');
?>
Please could you assist with how to filter the essential grid posts to only show the author’s posts on their profile page.
Note: The profile.php file has the above commented out while the issues is being resolved.