Custom WP_Query Loop Working with Pagination and WP-PageNavi

<?php
$temp = $wp_query;
$wp_query= null;
$wp_query = new WP_Query(‘cat=-6&paged=’ . $paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>

<?php // the usual post-displaying codes here ?>

<?php
endwhile;
if(function_exists(‘wp_pagenavi’)) { wp_pagenavi(); }
$wp_query = null; $wp_query = $temp; ?>


Custom WP_Query Loop