Answer the question
In order to leave comments, you need to log in
Outputting posts from a specific category through its name?
I display posts by category ID like this:
<?php
query_posts('cat=4');
while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>">
<div class="post-prew">
<img src=<?php the_post_thumbnail(); ?></img>
</div>
</a>
<?php
endwhile;
?>
Answer the question
In order to leave comments, you need to log in
If you need via slug, then like this:
$slug = 'Url название категории';
$cat = get_category_by_slug($slug);
query_posts('cat='.$cat->cat_ID);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question