• I need to select posts that belong in TWO categories.
    How do I add “category__and” into this code?
    Please help!

    function excerptlist_func($atts) {
    	extract(shortcode_atts(array(
    		'titleonly' => 'n',
    		'cat' => '',
    		'num' => 5,
    		'offset' => '',
    	), $atts));
    
    	$args = array('posts_per_page' => $num, 'offset' => $offset );
    	$id = get_cat_id($cat);
    	$args['cat'] = $id;
    
    	$loop = new WP_Query( $args );
            $posts = array();
            foreach($loop->posts as $p) { $posts[] = $p; }
    	global $post;
    	$opost = $post;
    	ob_start();
Viewing 1 replies (of 1 total)
  • Thread Starter sob1

    (@sob1)

    I tried to figure it out myself but a huge headache hit me and I felt bad down groaning….
    Exclude post from a category would help also ??
    Please help!

Viewing 1 replies (of 1 total)
  • The topic ‘Display posts matching two categories.’ is closed to new replies.