Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End How to 'query' a Custom Post Type Reply To: How to 'query' a Custom Post Type

#157578
Senff
Participant

A very simple query for a custom post type would be something like this:

$custquery = new WP_query (
    array(
    'post_type'=> 'speakers',
    'posts_per_page' => 5
    )
);

while ( $custquery -> have_posts() ) : $custquery -> the_post();

    echo the_title();
    echo the_content();

endwhile;   

wp_reset_query();