Navigation using next/previous_posts_link
-
Hello,
I’m trying to use next_posts_link and previous_posts_link in a loop generated by WP_Query (query_posts would do the same) but I’m having problems with “previous_posts_link”.$paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $latest_news_query = new WP_Query(array('post_type' => 'post', 'posts_per_page' => 2, 'paged' => $paged)); if($latest_news_query->have_posts()): while ($latest_news_query->have_posts()) : $latest_news_query->the_post(); [...] endwhile; previous_posts_link('Older'); next_posts_link('Newer'); endif;
– If I go to “/my-page/” (the main page) the ‘Older’ link doesn’t show.
– If I go to “/my-page/page/2/” (the second paginated page) the ‘Newer’ link pointing to /my-page/ it’s shown while the ‘Older’ not.
The 2 could be changed with 3,4,5… and the result is the sameAnyone could help me?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Navigation using next/previous_posts_link’ is closed to new replies.