Have you added the 'paged' and 'posts_per_page' arguments to your query? –
'paged' => $paged,
'post_per_page' => get_option('posts_per_page'),
This is how WP works out what results to get, and it’s done automatically for index.php but not on many other templates.
Thanks.
Maybe thats the error, my code doesnt look exactly like that anyway. This is what my code looks like :
http://pastebin.com/7DCRgLqT
Could you be so kind and tell me how I should write it instead? I´m a beginner and not sure where I should fit in that piece of code you wrote.
Thanks!
—
I got this to almost work as I like! The pagination works now with this code:
<?php if (have_posts()) : ?>
<?php $paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1; query_posts(“cat=45&paged=$paged”); ?>
<?php while (have_posts()) : the_post(); ?>
Thanks a lot for helping me with that. But one question; this code paginates my page according to the number of posts set in the backend. But If i want to specify my own number of posts in this query, where and what do I type?
Thanks!
Ok, can’t be sure as all I can see is this little snippit, but try this – http://pastebin.com/QhG61KdM
Basically, you were running the query after you had cheked to see if there were any posts, so the query was never being run.
You may also need to add global $paged to the top of the file/funciton that holds this code, but try without first.
Thank you so very much! It works just as I want it!
You are welcome. Could you please mark this thread as ‘Resolved’ using the drop-down on the right?
Yes of course, sorry I forgot 🙂