Created
February 23, 2012 16:12
-
-
Save jamesmehorter/1893476 to your computer and use it in GitHub Desktop.
Author
jamesmehorter
commented
Feb 23, 2012
have_posts()) :
while ($spare_parts->have_posts()) : $spare_part->the_post();
//Grab the spare_part meta and loop through the values
foreach (get_post_custom( $post->ID ) as $meta_value) :
//Grab the products with the same title as the meta value
$related_products = new WP_Query("post_type=product&post_title=$meta_value");
if ($related_products->have_posts()) :
while($related_products->have_posts()) : $related_products->the_post();
//Display a list of all products
echo $post->post_title;
endwhile;
endif;
endforeach ;
endwhile;
endif;
//Set the default page query back to itself
wp_reset_query();
```
?>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment