Created
March 14, 2024 19:34
-
-
Save zackeryfretty/9f3a503cedb52348ca203912cb235d51 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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