php - Limit main WordPress loop by category -
in archive.php file of custom theme, want show posts of category. suggested elsewhere add before if( have_posts() ):
$posts = get_posts('category=1');
however, seems disregard other filtering may in place (such post date, post author, etc.).
i don't want remove other filtering in place. want say: "and show posts category=1". doable?
you try merging new filters existing filters:
global $wp_query; $posts = get_posts( array_merge( array('category' => '1'), $wp_query->query ) );
Comments
Post a Comment