Suppose Your post type slug is cars :

Code For Display Posts At Page Template:

<?php /* Template Name: cars  */ 

$args = array(
            'post_type' => 'cars',
            'post_status' => 'publish',
            'order' => 'ASC'

$the_query = new WP_Query( $args );
if ( $the_query->have_posts() ) :
while ( $the_query->have_posts() ) : $the_query->the_post();?>

         /*for display post Title*/
        <td><?php the_title(); ?></td>
        /*for display posts Thumbnail*/
        <td><?php the_post_thumbnail( 'medium' ); ?></td>

<?php endwhile;endif;?>


<?php wp_reset_postdata();?>

Note: pastle this to new created file in active themes folder save it and select template after created page in back end of WordPress
I Hope this will Help :)

  • WordPress Stack Exchange! Please explain what your question is.
    – fuxia
    Dec 22, 2021 at 9:37
  • This is a question for me before 3 month and i search whole internet but i didn't found that's why i think today when i know the answer i should post that's why i posted. Dec 23, 2021 at 5:26
  • Then post question and answer as separate posts. This way you might even get a better answer, which filtering pre_get_posts, not a new query. :)
    – fuxia
    Dec 23, 2021 at 7:56


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.