Share Pastebin
Guest
Public paste!

Untitled

By: a guest | Mar 19th, 2010 | Syntax: PHP | Size: 0.49 KB | Hits: 157 | Expires: Never
This paste has a previous version, view the difference. Copy text to clipboard
  1. <?php
  2. /*
  3. Template Name: Custom Type Query Test
  4. */
  5. // assuming post type 'course' has been created and there is at least one course entry
  6.  
  7. $wp_query = null;
  8. $wp_query = new WP_Query();
  9. $wp_query->query('post_type=course');
  10. $posts = null;
  11. $posts = $wp_query->posts;
  12.  
  13. //var_dump($posts);
  14.  
  15. <?php if ($wp_query->have_posts() ) : while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>
  16.     <title><?php the_title(); ?></title>
  17.     <?php the_content(); ?>
  18. <?php endwhile; endif; ?>
  19. ?>