Query Custom Taxonomies
-
Hi. I’m using a custom taxonomy called ‘relations’ to do a poor man’s related posts version (since I already use a related posts plugin for another purpose). I’ve set up a custom query to display posts sharing the ‘relation’ but when a posts has two relations it horribly fails (displays nothing).
This is the code I use:
function related_mess() { $relation = get_the_term_list( $post->ID, 'relations',' ', ', ', '' ); if(!empty($relation)) { ?> <div stuff> <?php $rmquery = new WP_query(array('relations' => $relation, 'showposts' =>10, 'post__not_in' => array($exclude))); while ( $rmquery->have_posts()) : $rmquery->the_post(); ?> [do stuff]
I know where it goes wrong, it’s simply ‘relations’ => wants a string and doesn’t really get it. How do I fix this?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Query Custom Taxonomies’ is closed to new replies.