Created
June 28, 2012 19:05
-
-
Save stompweb/3013240 to your computer and use it in GitHub Desktop.
WordPress Pagination
This file contains 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
<div id="content"> | |
<h1>Ice Creams</h1> | |
<?php | |
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1; | |
$args = array( | |
'posts_per_page' => 5, | |
'paged' => $paged | |
); | |
$wp_query = new WP_Query( $args ); | |
if ( have_posts() ) : while ( $wp_query->have_posts() ) : $wp_query->the_post();?> | |
<div class="icecream"> | |
<h3><?php the_title(); ?></h3> | |
<?php the_excerpt(); ?> | |
<a href="<?php the_permanlink(); ?>" class="more">Read More</a> | |
</div> | |
<?php endwhile; ?> | |
<div id="pagination"> | |
<div id="next-page"> | |
<?php next_posts_link('« Older Entries') ?> | |
</div> | |
<div id="previous-page"> | |
<?php previous_posts_link('Newer Entries »') ?> | |
</div> | |
</div> | |
<?php endif; ?> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment