Hey.
I’ve been trying to figure it out on creating a custom category page with pagination. I’ve tried in so many ways but I cant get the pagination right. I got 404 error every time with my code. The code itself is from WordPress Codex.
<?php
// the query to set the posts per page to 3
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array('posts_per_page' => 1, 'paged' => $paged, 'cat' => '7' );
query_posts($args); ?>
<!-- the loop -->
<?php if ( have_posts() ) : while (have_posts()) : the_post(); ?>
@php
the_title();
@endphp
<!-- the title, the content etc.. -->
<?php endwhile; ?>
<!-- pagination -->
<?php next_posts_link(); ?>
<?php previous_posts_link(); ?>
@php
get_the_posts_navigation();
@endphp
<?php else : ?>
<!-- No posts found -->
<?php endif; ?>
What i actually wanted to do is paged category with only one article on one page.
Thank u for any help.