I think you are halfway there… you assign the proper stuff to $paged
Do you now include the $paged variable into your query posts?
(also, page should be paged, and I think your parenthesis might be wacky — I believe you use ‘page’ on page templates, else ‘paged’)
<?php
$paged = ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 );
query_posts( array(
'posts_per_page' => 5,
'cat' => '10',
'paged' => $paged
));
?>
or simply
<?php query_posts( array(
'posts_per_page' => 5,
'cat' => '10',
'paged' => ( get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1 ),
));
?>
http://vudu.me/10f
My little writeup about using it
I’m kinda confused ! here is my index.php can you take a look at it please? Something might be wrong on it π
[Code moderated as per the Forum Rules. Please use the pastebin]
http://scribu.net/wordpress/wp-pagenavi/right-way-to-use-query_posts.html
The codex for query posts links here
(Queries aren’t my strength), but reading that article, all I can suggest is to change both ‘page’ to ‘paged’
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
In that line, as your file is an index, and not a page
all I can suggest is to change both ‘page’ to ‘paged’
<?php $paged = (get_query_var(‘page’)) ? get_query_var(‘page’) : 1; ?>
In that line, as your file is an index, and not a page
I’ve tried this, but i got back to where i’ve started. When i try to get the second page i get the error message that says that the page is not found…
i don’t get it !
You can give your permalinks a reset by going to the settings->permalinks page and hitting save. Worth a try! That has often cleared up 404 errors for me
the line
<?php $paged = (get_query_var('page')) ? get_query_var('page') : 1; ?>
shows at least all the articles.
right, but it doesn’t paginate
many proposed solutions talk about an array..in my index file i don’t see any array ! could this be the source of the problem ?
if you’d like, throw your code back up into a pastebin and report the link here. Maybe someone else can take a better look than me.
The array really does the same thing as the way your code is written
It’s cleaner, and easier to look at. Your code should provide the same functionality.
indeed, i added an array to my code…it does the same thing and the problem is still the same.. thank you Rev.Voodoo for your help π
this is my index file index.php