Filter Posts Using Query Posts


/ Published in: PHP



Copy this code and paste it in your HTML
  1. query_posts('showposts=5&category_name=featured');
  2. if ( have_posts() ) : while ( have_posts() ) : the_post();
  3. <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
  4. <p><?php the_content(); ?></p>
  5. endwhile; else:
  6. endif;
  7. wp_reset_query();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.