This solution needs to be revised for that pagination functions are in functions.php.
I am using Reverie master theme (which uses foundation framework), that theme uses pagination function which is in functions.php
if( ! function_exists( 'reverie_pagination' ) ) {
function reverie_pagination() {
global $wp_query;
$big = 999999999; // This needs to be an unlikely integer
// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link($big) ),
'current' => max( 1, get_query_var('paged') ),
'total' => $wp_query->max_num_pages,
'mid_size' => 5,
'prev_next' => True,
'prev_text' => __('«'),
'next_text' => __('»'),
'type' => 'list'
) );
// Display the pagination if more than one page is found
if ( $paginate_links ) {
echo '<div class="pagination-centered">';
echo $paginate_links;
echo '</div><!--// end .pagination -->';
}
}
}
I have revised this function as
if( ! function_exists( 'reverie_pagination' ) ) {
function reverie_pagination() {
global $wp_query, $another_query;
$big = 999999999; // This needs to be an unlikely integer
if ( is_front_page()) {
$myqueryis = $another_query;
$paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
} else {
$myqueryis = $wp_query;
$paged = get_query_var('paged');
}
// For more options and info view the docs for paginate_links()
// http://codex.wordpress.org/Function_Reference/paginate_links
$paginate_links = paginate_links( array(
'base' => str_replace( $big, '%#%', get_pagenum_link($big) ),
'current' => max( 1, $paged ),
'total' => $myqueryis->max_num_pages,
'mid_size' => 5,
'prev_next' => True,
'prev_text' => __('«'),
'next_text' => __('»'),
'type' => 'list'
) );
// Display the pagination if more than one page is found
if ( $paginate_links ) {
echo '<div class="pagination-centered">';
echo $paginate_links;
echo '</div><!--// end .pagination -->';
}
}
}
the variable $another_query is my custom WP_Query. This questions author used *query_posts* to get results but I have used *new WP_Query*.
And the query which I have used inside front-page is;
$args = array(
'post_type' => 'post',
'post__not_in' => $do_not_duplicate,
'paged' => $paged,
);
$another_query = new WP_Query( $args );