Проблема с пагинацией кастомных данных
Не работает пагинация в template-page. Из темплейта цепляется петля :
<?php
$args = array(
'post_type' => 'replys',
'paged'=> $paged,
'showposts' => 2
);
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query = new WP_Query( $args );
// Cycle
if ( $query->have_posts() ) {
?>
<div class="reply-items-full">
<?php
while ( $query->have_posts() ) {
$query->the_post();
?>
<div class="col-lg-12 reply-item-full">
<span class='reply-content-full'><?php echo get_the_content(); ?></span>
<span class="reply-author-full"><?php echo array_pop(get_post_meta($query->post->ID,'reply_author_name')); ?></span>
</div>
<?php } ?>
</div>
<?php } else {
// No posts found
}
echo paginate_links();
/* Return original post data. Reset $post. */
wp_reset_postdata();
?>
Пагинация по какой-то причине не выводится вовсе. Кастомные посты выводятся корректно. Никак не могу взять в толк почему так происходит.
Вот код темплейта, из которого вызывается петля:
<?php get_header(); ?>
<div class="row">
<div class="main-content col-lg-7" role="main">
<?php while(have_posts()) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<!-- Article header -->
<header class='entry-header'> <?php
// If the post has a thumbnail and it's not password protected
// then display the thumbnail
if (has_post_thumbnail() && !post_password_required()) : ?>
<figure class='entry-thumbnail'><?php the_post_thumbnail(); ?></figure>
<?php endif; ?>
<h1 class='title-stripe'><?php echo get_the_title(); ?></h1>
</header>
<?php endwhile; ?>
<?php get_template_part( 'reply-loop', 'reply' ); ?>
</article>
</div><!-- end main-content -->
<?php echo do_shortcode('[reservation_form]'); ?>
</div>
<?php get_footer(); ?>
Сначала определяйте переменную $paged, а потом $args