Modification of custom loop
-
Hi, community
I have a custom loop that shows 20 posts in total on a certain page. The posts are from several categories. That works perfectly. But I need to change it.I would like to have:
20 posts only of the category 2
all posts of other cats can be displayed without any limitation. Is this possible?My loop goes like this:
global $post; $tmp_post = $post; $args = array( 'numberposts' => '20', 'orderby' => 'date', 'order' => 'DESC', 'cat' => array(1,2,7,8,9,27, 30, 31), 'tax_query' => array( array( 'taxonomy' => 'post_format', 'field' => 'slug', 'terms' => array( 'post-format-aside','post-format-video' ), ), ) ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post);
Can anybody help me with that?
Thanks!
Raphael
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Modification of custom loop’ is closed to new replies.