0

If anyone has any suggestions or know what I'm doing wrong would be a great help. I'm wanting 3 custom news posts per page and then links to the next list of news items and so on. I've tried next page not posts plugin and this takes me to the next parent page which would be contact page. Thanks

<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;?>
<div style="float:right;"><?php echo "Page " . $paged;?></div>
<?php 
$loop = new WP_Query(array(
'post_type' => 'news',
'paged' => $paged,
'posts_per_page' => 3,
'orderby' => 'menu_order'
));
?>   
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>

<?php get_template_part('news-single', get_post_format() ); ?>

<?php endwhile; // end of the loop. ?>
 <div class="pnavigation">
    <div class="alignleft"><?php  previous_posts_link('Previous') ?></div>
    <div class="alignright"><?php  next_posts_link('More') ?></div>
 </div>
0

what is not working with your existing code?

try to use:

<div class="alignleft"><?php  previous_posts_link('Previous',$loop->max_num_pages) ?></div>
<div class="alignright"><?php  next_posts_link('More',$loop->max_num_pages) ?></div>

and add <?php wp_reset_postdata(); ?> at the end of your code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.