wordpress deafult paggination
//this is for post query with default paggination and
//post with comment only
<?php
$paged = ( get_query_var('paged') ) ? get_query_var( 'paged' ) : 1;
query_posts(
array (
'comment_count' => array(
'value' => 1,
'compare' => '>=',
),
'post_type' => 'gallery',
'posts_per_page' => 10,
'paged' => $paged )
);
// The Loop
while ( have_posts() ) : the_post();
?>
the_post_thumbnail() ;
etc etc
here you can call anyting you want
<?php
endwhile;
the_posts_pagination( array( 'mid_size' => 2 ) ); //this function is for calling the paggination on custom tempalate page
// Reset Query
wp_reset_query();
?>