[Help] Category Recent Posts Pagination
-
In my category (which can be seen from here https://newgeek.com.br/games/) I cal the last post, then I call the 2 posts before that. And then if you scroll down you’ll notice “Old News” that is where I call the last 10 posts of the category to show.
As of now I call the 10 posts with:
<?php global $post; $cntr = 1; $myposts = get_posts('category=2&numberposts=10&order=des'); foreach($myposts as $post) : setup_postdata($post);?> Call images and titles and etc <?php $cntr++; ?> <?php endforeach; ?>
And I can’t get pagination to work. I’m almost sure that it’s because I’m using get post while I should use a Loop.
Well the thing is, I have been trying using loops and still it won’t work. I either find that the “https://newgeek.com.br/games/page/2/” didnt work or it showed me the same thing (and sometimes screws the other loop I have up there at the beginnning to call the 3 posts…).
Even funnier is that my pagination code for the Search is working…
` <?php
global $wp_query;
$big = 999999999; // need an unlikely integer
echo paginate_links( array(
‘base’ => str_replace( $big, ‘%#%’, esc_url( get_pagenum_link( $big ) ) ),
‘format’ => ‘?paged=%#%’,
‘current’ => max( 1, get_query_var(‘paged’) ),
‘total’ => $wp_query->max_num_pages ) ); ?> `I’m not good with php or wordpress loops, but I get by… The thing is that it’s being very stressful to try and try and nothing seems to work. If you guys could give me some insight on wich code to use for the loop that will work with pagination I’d be very thankful.
What I want to do is make a way that people can acess older posts of the category. Showing 10 per time.
- The topic ‘[Help] Category Recent Posts Pagination’ is closed to new replies.