custom post type query by category code example
Example 1: wp_query get custom post type
<?php
$args = array(
'post_type' => 'custom_type',
'post_status' => 'publish',
'posts_per_page' => 8,
'orderby' => 'title',
'order' => 'ASC',
);
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
print the_title();
the_excerpt();
endwhile;
wp_reset_postdata();
?>
Example 2: wp_query to get posts
<?php
$args = array(
'post_type' => 'post',
'post_status' => 'future'
);
$scheduled = new WP_Query( $args );
if ( $scheduled->have_posts() ) :
?>
<?php while( $scheduled->have_posts() ) : $scheduled->the_post() ?>
<?php endwhile ?>
<?php else : ?>
<?php endif ?>