Display related post from same category only, need some help!
-
using this code:
function related_posts() { $args = array( 'tag__in' => $tag_ids, 'post__not_in' => array (get_the_ID()), 'posts_per_page'=>4, 'caller_get_posts'=>1, 'orderby'=>'rand' ); $the_query = new WP_Query( $args ); while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
this is running on single pages only, how could i modify the code to only include related posts from the same category as the single post (they are always only in 1 category)
can i use ‘cat_not_in’ => array (‘1′,2′,’3’)), to exclude categories specified by id?
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Display related post from same category only, need some help!’ is closed to new replies.