Posted By

alexchen on 01/20/11


Tagged

wordpress


Versions (?)

Retrieve custom post types with a category


 / Published in: PHP
 

  1. <?php $posts = new WP_Query(array(
  2. 'post_type' => 'here_goes_my_post_type',
  3. 'category' => 'Here Goes My Category',
  4. )); ?>
  5. <?php while ( $posts->have_posts() ) : $posts->the_post(); ?>
  6. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  7. <h2><?php the_title(); ?></h2>
  8. <?php the_content(); ?>
  9. </div>
  10. <?php endwhile; ?>
  11. <?php wp_reset_query(); ?>

Report this snippet  

You need to login to post a comment.