}, 10, 2);
add_filter('glm-has-trail-product', function($member_id) {
- $products = get_posts(
+ wp_reset_query();
+ $posts = get_posts(
array(
- 'post_status' => 'publish',
- 'post_type' => 'product',
+ 'post_status' => 'publish',
+ 'post_type' => 'product',
'posts_per_page' => -1
-// 'meta_query' => array(
-// array(
-// 'key' => 'trail_id',
-// 'value' => $member_id
-// )
-// )
)
);
- foreach ($products as $product) {
+ foreach ($posts as $post) {
// Explode the (hopefully) comma-separated list of member IDs into an array
- $member_ids_for_product = explode(',', get_field( 'trail_id', $product->ID ) );
-
+ $member_ids_for_product = explode(',', get_field( 'trail_id', $post->ID ) );
+
// If the current member is in the list of IDs
if (in_array($member_id, $member_ids_for_product)) {
return true;
- } else {
- return false;
}
}
+ return false;
});
add_action('thematic_searchloop', 'mytheme_search_loop');