1 <?php
2 $args = array(
3 'post_type' => 'custom_type',
4 'post_status' => 'publish',
5 'posts_per_page' => 8,
6 'orderby' => 'title',
7 'order' => 'ASC',
8 );
9
10 $loop = new WP_Query( $args );
11
12 while ( $loop->have_posts() ) : $loop->the_post();
13 print the_title();
14 the_excerpt();
15 endwhile;
16
17 wp_reset_postdata();
18 ?>
1<?php
2$args = array(
3 'post_type' => 'product',
4 'posts_per_page' => 10,
5);
6$loop = new WP_Query($args);
7while ( $loop->have_posts() ) {
8 $loop->the_post();
9 ?>
10 <div class="entry-content">
11 <?php the_title(); ?>
12 <?php the_content(); ?>
13 </div>
14 <?php
15}
16
1//WordPress: Query a custom post type
2//For example, query all Case Study post types
3
4<?php query_posts('post_type=case_studies'); ?>