// WP_Query arguments
$args = array (
'post_type' => array( 'my_custom_post_type' ),
'post_status' => array( 'publish' ),
'posts_per_page' => '10',
'posts_per_archive_page' => '10',
);
// The Query
$custom_query = new WP_Query( $args );
// The Loop
if ( $custom_query->have_posts() ) {
while ( $custom_query->have_posts() ) {
$custom_query->the_post();
// do something
the_title();
}
// Пагинация
the_posts_pagination();
} else {
// no posts found
}
// Restore original Post Data
wp_reset_postdata();
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
// WP_Query arguments
$args = array (
'post_type' => array( 'news' ),
'post_status' => array( 'publish' ),
'posts_per_page' => '2',
'posts_per_archive_page' => '2',
'paged' => $paged
);