Nowadays I am working on one site which is in WordPress and site will have multiple posts from the single category and per page maximum 10 posts will be displayed. If post within a category is more than 10, pagination comes.
so for that I have created one function wph_pagination which is working fine for other sites but it is not working here.
Pagination links are coming but when I am clicking the link, I will get “404 page not found ” error or same content will be displayed on all the page links.
Lets have a look into the code i have written:
query_posts( array( 'cat' =>$cat , 'order' => 'DESC' ) );
while(have_posts()) : the_post();
/* my content goes here */
// Pagination function called here
Here I have called query_post function because I want to get multiple posts from the specific category.
I have just added one line which I forgot to add before query_posts and because of it pagination was not working.
After adding following line of code, pagination working fine.
so Lets check what changes I have done :
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;