Created
February 1, 2015 19:58
-
-
Save fahdi/48f3fe442d12d5ca00c8 to your computer and use it in GitHub Desktop.
Wordpress Custom Post types Paging in Custom Page templates
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
<?php | |
/* | |
*Template Name: Specials and Events | |
*/ | |
get_header(); | |
?> | |
<div class="blog-list"> | |
<div class="container"> | |
<div class="row"> | |
<div class="col-md-9"> | |
<section class="blog-main blog-event-main text-center" role="main"> | |
<?php | |
$temp = $wp_query; | |
$wp_query = null; | |
$wp_query = new WP_Query(); | |
$wp_query->query('showposts=3&post_type=specialevents'.'&paged='.$paged); | |
if ( $wp_query->have_posts()) :?> | |
<div class="blog-list-wrap"> | |
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); ?> | |
<?php | |
get_template_part("content","excerpt"); | |
?> | |
<?php endwhile;?> | |
</div> | |
<div class="row list-pagition text-center"> | |
<div class="nav-next col-sm-6 col-md-6 text-left"><?php next_posts_link('OLDER POSTS'); ?></div> | |
<div class="nav-previous col-sm-6 col-md-6 text-right"><?php previous_posts_link('NEWER POSTS'); ?></div> | |
</div> | |
<?php | |
endif; | |
$wp_query = null; | |
$wp_query = $temp; | |
?> | |
</section> | |
</div> | |
<div class="col-md-3"> | |
<?php | |
get_template_part("specials","sidebar"); | |
?> | |
</div> | |
</div> | |
</div> | |
</div> | |
<? | |
get_footer(); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment