Я хочу показать ссылку на следующую страницу на странице myCustomPage-archive.php, но на всех страницах отобразить одинаковые сообщения.
<?php
$args = array(
'post_type' => 'doctors',
'orderby' => 'date',
'order' => 'DESC',
'posts_per_page' => 10,
'paged' => get_query_var('paged')
);
$review_query = new WP_Query( $args );
?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
<!-- rest of the loop -->
<!-- the title, the content etc.. -->
<?php endwhile; ?>
<!-- pagination -->
<div class="news-select-page-next button pull-left">
<?php next_posts_link(); ?>
</div>
<?php if ($paged>1) : ?>
<div class="news-select-page-previous button pull-right">
<?php previous_posts_link(); ?>
</div>
<?php endif;?>
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
Как я могу решить эту проблему. Я закодировал это в function.php:
function my_custom_posts_per_page( $query ) {
if (!is_admin() && post_type_exists('doctors') )
$query->set( 'posts_per_page', 10 );
}
add_filter('parse_query', 'my_custom_posts_per_page');