To fix 404 page errors while using wp_paginate() in wordpress.
while going to sample-page/page/2 will leads to 404 as the 'page' will be taken as a category.
SO we need to use the 'page' as a query string while using query_posts
Steps 1:
--------
Open the php page (sample: test.php) in a text editor and add this code:
while going to sample-page/page/2 will leads to 404 as the 'page' will be taken as a category.
SO we need to use the 'page' as a query string while using query_posts
Steps 1:
--------
Open the php page (sample: test.php) in a text editor and add this code:
<code><?php
global $query_string;
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts($query_string.'&paged='.$paged.'&posts_per_page=3');
// for getting results of 3rd page
?>
Step:2
------
</code>
- Login as the admin
- Go to the Settings.
- Go to the Reading.
- Change the Blog pages show at most to any number. Ex, 5.
- Save the changes.
- View the blog
If everything goes well, your pagination should be working perfectly fine without you changing any code.
1 comment:
This solution solve my problems. Thank you!
Post a Comment