I am trying to view custom post type posts in WordPress and stuck with the code below.
$args = array(
'type' => 'theslider',
'orderby' => 'date',
'order' => 'DESC',
'cat' => 23
);
$lasts = new WP_Query( $args );
if( $lasts->have_posts() ):
while( $lasts->have_posts() ): $lasts->the_post();
the_title( sprintf('<a href="%s"><div class="pt10 title">', esc_url( get_permalink() ) ),'</div></a>' );
endwhile;
endif;
wp_reset_postdata();
This code works with the default post type. And the Custom Post Type function works well in the admin panel.
How can I view custom post type posts on WordPress home page.