I have a two custom post types "venues" and "events".. How do i query "venues" then display all the "events" that have the same taxonomy values.
<?php
$taxonomy = 'venue-name';
$param_type = 'venue-name';
$tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args);
if ($tags) {
foreach ($tags as $tag) {
$args = array(
'post_type' => 'venues',
"$param_type" => $tag->slug,
'post__not_in' => array($post->ID),
'showposts'=> 1,
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post();
?>
Aucun commentaire:
Enregistrer un commentaire