Pagination with wp_pagenavi not working on custom page
I am having trouble with wp_pagenavi
working on the start page using a custom query. It's working well on every standard template like category.php. But not on the homepage.
Here is the code:
?php
$args=query_posts(array(
'post__not_in'= array(419),
'post_type' = 'post',
'posts_per_page' = 10,
'paged' = get_query_var('page'), ));
$my_query = new WP_Query($args);
if( $my_query-have_posts() ) {
while ($my_query-have_posts()) : $my_query-the_post(); ?
?php
$featuredImage = wp_get_attachment_url( get_post_thumbnail_id($post-ID) );
$s1=strtolower($title);
?
div id="post-?php echo $post-ID;?" ?php $item_format = is_video() ? 'video' : 'post'; post_class('item cf item-'.$item_format); ?
div class="thumb"
?PHP 'a class="clip-link" data-id="'.$post-Id.'" title="'.esc_attr(get_the_title($post-Id)).'" href="'.get_permalink($post-Id).'"'?
a class="clip-link" title="?php the_title();?" href="?php the_permalink();?" rel="bookmark"
span class="clip"
?php echo'img src="'.$featuredImage.'" alt="'.esc_attr(get_the_title($post-Id)).'" /';?
span class="vertical-align"/span
/span
span class="overlay"/span
/a
/div!--- thumb-----
/div!-- end #post-?php the_ID(); ? --
?php
endwhile;
global $my_query;
$total_pages = $my_query-max_num_pages;
if($total_pages 1)
{ ?
div class="loop-nav pag-nav"
div class="loop-nav-inner"
?php
if(function_exists('wp_pagenavi')) {
wp_pagenavi();
} else {
$label = __('laquo; Prev', 'dp');
if($prev = get_previous_posts_link($label))
echo str_replace('a', 'a clas="prev"', $prev);
else
echo 'span class="prev"'.$label.'/span';
$label = __('Next raquo;', 'dp');
if($next = get_next_posts_link($label))
echo str_replace('a', 'a class="next"', $next);
else
echo 'span class="next"'.$label.'/span';
} ?
/div
/div!-- end .loop-nav --
?php
}
}
wp_reset_query(); // Restore global post data stomped by the_post().
?
/div!---nag cf----
/div!---loop-content grid-mini---
The pagination shows up, but the url /page/2/
is not working, it shows /page/1/
result.
Topic plugin-wp-pagenavi pagination Wordpress
Category Web