I’am creating a website at WordPress and in my website there exist a post type called “news”. What I ask for is I’m showing 5 posts in a page but I couldn’t show the “next page” button. My code is below, if anyone can help.
<div class="row10 offset1">
<div class="news">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array( 'post_type' => 'news', 'posts_per_page' => 5, 'paged' => $paged );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post(); ?>
<div class="row-fluid">
<div class="well-small">
<?php the_title(); ?>
<?php the_content(); ?>
<?php the_date("d.m.Y"); ?>
</div>
</div>
<?php
endwhile;
?>
</div>
<div class="pull-right">
<ul class="pager">
<li> <?php echo previous_posts_link();?></li>
<li><?php echo next_posts_link();?></li>
</ul>
</div>
<div class="clearfix"></div>
</div>
I’ve solved my problem, but I don’t know how it happened. =) I’ve added query_posts($args); and it worked properly.