Ive searched around for an answer to this and saw a couple of the same posts around with the same problem, but no actual answer unfortunately.
Problem being I have 3 seperare categories being displayed on 1 page… I would like to make it so that the Main category of the page can be scrolled through to older posts with pagination.
I put the code in after <?php endwhile ?>, the pagination displayed, and the links worked, however the posts on the page remained the same and didnt change regardless of which page I went to.
After reading some older posts I have probably used ‘query_posts’ wrong, so hopefully somebody here can help.
Im using Query_Posts 3 times like so:
<?php query_posts('category_name=news'); while ( have_posts() ) : the_post() ?> // styling here // <?php endwhile ?>
Then that is simply repeated on the page with a different category_name.
Link to site: http://www.thefightlounge.co.uk
<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args= array( 'category_name' => 'news', 'paged' => $paged ); query_posts($args); ?>
A little more info one where to place the code would be brilliant.
Do I need to add this to every place ive currently used the Query_Posts?
Or just on the posts I would like to Paginate?
With the code above placed just on the main “News” part of the query it looks like this (and doesnt work still)
Heres link to current code: http://wordpress.pastebin.com/JZDiK1tX
Apologies for posting 3 times. Any toher help available? Or the above code being explained? cheers
Problem being I have 3 seperare categories being displayed on 1 page
What template file is this in?
Do you use multiple loops?
Put the full full content of the template file you are using in the pastebin.
Pastebin Link : http://wordpress.pastebin.com/tBisk8P2
This is in the homepage template
$paged is never defined in this query as per above…..
This is with the code added from further up the page, that I think I entered wrong… http://wordpress.pastebin.com/XcPAtR9F
Have you tried it with the code esmi gave you?
Pastebin link: http://wordpress.pastebin.com/5Rgs3udr
well, now I’m more confused…you have the query on line 17…. and then what looks like a loop starting at 27, but no loop opening (if have posts/while have posts…)
and no endwhile, so that first loop isn’t really a loop….so that may be what throws that pagination
line 38 and 52 are both nav links, not in a loop
and the 63 and 81 are queries again, that do have full loop (while have posts/end while) but no pagination in the query…..
Rev. Voodoo, Which pastebin link are you referring to? (Theres about 3 different ones above haha).
Could you please submit the edit on the pastebin too and ill test it out.
I was referring to this one
Which one are you using that you are trying to get functioning correctly?
Im trying to get any that will get the pagination to work just on that main ‘News’ Category…
while ( have_posts() ) : the_post()after
query_posts($args);and then the endwhile After the post styling, then the navigation straight after endwhile.
Still doesnt work… Did i add them in the wrong order/wrong place?
Something like that for the first loop….
Thing is I’m not sure why you have double nav, etc for the news section…. Also had to reset the query after that
Every query should have a reset after it on multiple loops…. there is definitely more work to be done here, just guiding a bit….
- The topic ‘Query posts and Pagination Links Broken’ is closed to new replies.