<?php while ( have_posts() ) : the_post();
$paged_string = is_home() || is_front_page() ? 'page' : 'paged';
$paged = get_query_var( $paged_string ) ? get_query_var( $paged_string ) : 1;
$args = array(
'paged' => $paged,
'post_type' => 'post'
);
$all_posts = new WP_Query( $args );
$style = get_post_meta( $post->ID, 'krown_blog_style', true );
while ( $all_posts->have_posts() ) : $all_posts->the_post();
if ( $style == 'blog-standard-author' ) {
get_template_part( 'content-author' );
} else {
get_template_part( 'content' );
}
endwhile;
wp_pagenavi();
endwhile; ?>
add_action('template_redirect', function() {
if ( is_home() || is_front_page() ) {
global $wp_query;
$page = (int) $wp_query->get('page');
if ( $page > 1 ) {
// convert 'page' to 'paged'
$query->set( 'page', 1 );
$query->set( 'paged', $page );
}
// prevent redirect
remove_action( 'template_redirect', 'redirect_canonical' ); // убиваем редирект от /page/2
}
}, 0 );
<?php while ( have_posts() ) : the_post();
$paged_string = is_home() || is_front_page() ? 'page' : 'paged';
$paged = get_query_var( $paged_string ) ? get_query_var( $paged_string ) : 1;
$args = array(
'paged' => $paged,
'post_type' => 'post'
);
$all_posts = new WP_Query( $args );
$style = get_post_meta( $post->ID, 'krown_blog_style', true );
while ( $all_posts->have_posts() ) : $all_posts->the_post();
if ( $style == 'blog-standard-author' ) {
get_template_part( 'content-author' );
} else {
get_template_part( 'content' );
}
endwhile;
wp_pagenavi( array( 'query' => $all_posts ) );
<?php wp_reset_postdata(); ?>