Create Page Template that Work with WP_Query Loop and WP-PageNavi




In this tutorial we'll work with an amzing WP-PageNavi plugin by Lester Chan.
To work with your website properly. Please install it before you straight on...

Create a Page Template

<?php /* Template Name: ANY NAME YOU WANT */ ?>

Create a Custom Loop

<?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; ?>

Related Articles :

http://thewordpresswarrior.com/616/passing-variables-via-url

http://www.wplover.com/756/how-to-get-custom-wp_query-loop-working-with-pagination-and-wp-pagenavi/

{ 0 comments... read them below or add one }

Post a Comment