Created
August 18, 2013 18:53
-
-
Save tubiz/6263287 to your computer and use it in GitHub Desktop.
Making pagination works in custom page template in WordPress.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $paged; | |
$paged = (get_query_var('page')) ? get_query_var('page') : 1; | |
$args = array( 'post_type' => array('post'), 'paged' => $paged); | |
$wp_query = new WP_Query( $args ); | |
if( $wp_query->have_posts() ): | |
while ( $wp_query->have_posts() ) : $wp_query->the_post(); | |
?> | |
<div class="post"> | |
<?php the_title(); ?> | |
</div> | |
<?php | |
endwhile; | |
else: | |
?> | |
<p>No Posts Found</p> | |
<?php | |
endif; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment