OK - Looked everywhere for this one.
Details:
Custom Post Type #1 = 'product' > registered taxonomy 'productranges'
Custom Post Type #2 = 'testimonial' > registered taxonomy 'testimonials'
Both CPTs share categories 'Complete Food' , 'Treats', etc.. for example
Question:
How can I display a random post excerpt of the same shared-category from a 'Testimonial' post into 'Product' post? In a sense linking the Testimoinals to the Products.
I've used the following but it only shows a random post from all the categories, I need it to output from the current-shared category being viewed:
<?php
$posts = get_posts('post_type=testimonial&issue=$issueid&post_status=publish&numberposts=1&orderby=rand');
foreach ($posts as $post) : setup_postdata($post); ?>
<h3><?php the_title(); ?></h3>
<?php the_excerpt('<div class="readmore">'); ?><a href="/testimonials">read more...</a>
<?php endforeach; ?>
<?php
//Reset Query
wp_reset_query();?>
Cheers if you can help!