32 mins ago
32 mins ago

Reputation: 75

Displaying posts from a selected category only

How to display (by modifying a theme) posts from a certain category only instead of showing them all?

Upvotes: 1

Views: 299

Answers (3)

Frederik Wordenskjold
Frederik Wordenskjold

Reputation: 10221

In its simplest form:

$query = new WP_Query( 'category_name=foo' );

Upvotes: 0

velocityhead
velocityhead

Reputation: 172

The answers you seek lie in the Wordpress documentation. It's there if you look for more than 2 seconds: http://codex.wordpress.org/The_Loop#Loop_Examples

Upvotes: 1

mjspier
mjspier

Reputation: 6526

this should work

<?php query_posts('cat=1'); ?>
<?php while (have_posts()) : the_post(); ?>
  <!-- post's contents -->
<?php endwhile; ?>

Upvotes: 1

Related Questions