Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zackeryfretty/9f3a503cedb52348ca203912cb235d51 to your computer and use it in GitHub Desktop.
Save zackeryfretty/9f3a503cedb52348ca203912cb235d51 to your computer and use it in GitHub Desktop.
// Grab Testimonial Row 1 Output
function zf_get_testimonial_row_one_posts($settings, $query){
// Only Testimonial Row 1
if($settings->id == 'zf-praise-row-module-1') {
// Define Global Array
$GLOBALS['praise_to_exclude'] = [];
// Grab Testimonal Row 1 Posts
$query_posts = $query->posts;
// Add Each to Static Element as String
foreach($query_posts as $query_post) {
array_push($GLOBALS['praise_to_exclude'], strval($query_post->ID));
}
}
}
add_filter('pp_cg_before_posts', 'zf_get_testimonial_row_one_posts', 10, 2);
// Exclude Testimoinal Row 1 Posts from Row 2
function zf_exclude_testimonial_two_posts($settings, $query){
// Only Testimonial Row 2
if($settings->id == 'zf-praise-row-module-2') {
// Exclude Testimonial Row 1 Posts
$query->query_vars['post__not_in'] = $GLOBALS['praise_to_exclude'];
}
}
add_filter('pp_cg_before_posts', 'zf_exclude_testimonial_two_posts', 5, 2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment