Posted By

visualadvance on 02/05/12


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

zemonte
LauraMM79


Wordpress: Loop in Category


 / Published in: PHP
 

Just a snippet so I remember how to do a loop through just a certain category.

  1. <?php $my_query = new WP_Query('category_name=events&posts_per_page=4'); ?>
  2. <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  3. <?php the_title(); ?>
  4. <?php the_excerpt(); ?>
  5. <?php endwhile; ?>

Report this snippet  

You need to login to post a comment.