I use the code below to display posts in the ID 1 category , but instead of using the ID category, I'd like to use slug EX: cat = news
<?php query_posts('cat=1'); while ( have_posts() ) : the_post(); ?>
I use the code below to display posts in the ID 1 category , but instead of using the ID category, I'd like to use slug EX: cat = news
<?php query_posts('cat=1'); while ( have_posts() ) : the_post(); ?>
According to Wordpress documentation , I believe this will solve your problem:
query_posts( array(
'category_name' => 'my-category-slug',
'posts_per_page' => -1
) );