Created
May 9, 2016 11:22
-
-
Save vailjoy/a484c16f6f0e13c9b56a3bb13d859c61 to your computer and use it in GitHub Desktop.
Layers Blog Fixed Pagination 1.5.1
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: Blog | |
* The template for displaying post archives | |
* | |
* @package Layers | |
* @since Layers 1.0.0 | |
*/ | |
get_header(); | |
do_action( 'layers_before_blog_template' ); | |
get_template_part( 'partials/header' , 'page-title' ); ?> | |
<div class="container content-main archive clearfix"> | |
<div class="grid"> | |
<?php get_sidebar( 'left' ); ?> | |
<?php | |
if ( get_query_var( 'paged' ) ) { $paged = get_query_var( 'paged' ); } | |
elseif ( get_query_var( 'page' ) ) { $paged = ( get_query_var( 'page' ) ? get_query_var( 'page' ) : 1); } | |
$wp_query = new WP_Query( array( | |
'post_type' => 'post', | |
'paged' => $paged, | |
'page' => $paged, | |
) ); | |
if ( $wp_query->have_posts() ) : ?> | |
<div id="post-list" <?php layers_center_column_class(); ?>> | |
<?php while ( $wp_query->have_posts() ) : $wp_query->the_post(); | |
global $post; ?> | |
<?php get_template_part( 'partials/content' , 'list' ); ?> | |
<?php endwhile; // while has_post(); ?> | |
<?php the_posts_pagination(); ?> | |
</div> | |
<?php endif; // if has_post() ?> | |
<?php get_sidebar( 'right' ); ?> | |
</div> | |
</div> | |
<?php do_action( 'layers_after_blog_template' ); | |
get_footer(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment