jillsays
Member
Posted 1 year ago #
hi,
I'm trying to fix the main page of pophangover.com --- I would like all posts from the PICS category to be displayed first, followed by the posts in other categories.
It is working fine on the main page, but the PREVIOUS/NEXT pages all display the same thing and are infinitely looping. I can't figure out what i"m doing wrong. Here is my code. Any help would be GREATLY APPRECIATED!
[Code moderated as per the Forum Rules. Please use the pastebin]
jillsays
Member
Posted 1 year ago #
I had no idea there were new rules about code.
Here's the pastebin
http://wordpress.pastebin.com/X9rBnh7L
jillsays
Member
Posted 1 year ago #
Am I not closing a loop somewhere?
Could that be what's causing the pagination to just display the index over and over?
try to put a wp_reset_query(); before the query of the second loop:
<?php wp_reset_query();
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-495&paged=$page&posts_per_page=6"); ?>
http://codex.wordpress.org/Function_Reference/wp_reset_query
jillsays
Member
Posted 1 year ago #
Thank you for the tip --- that did work.
Is there a way to have the first loop (recent photos) show up ONLY on the index page? It's showing up on all of the pages.
(http://pophangover.com)
jillsays
Member
Posted 1 year ago #
jillsays
Member
Posted 1 year ago #
Can anyone point me in the right direction? I ended the first loop with the reset query, but it is still showing up on page 2, 3, etc.
Is this a pagination issue, or an issue with index.php or with the archive.php?
jillsays
Member
Posted 1 year ago #
I figured this out. In case anyone needs it in the future:
create a separate .php file with the loop you don't want to appear on the secondary pages, and then call to it like this:
< ?php if(is_home() && !is_paged()): ?>
< ?php include (TEMPLATEPATH . '/XXXXXXXXXXX.php'); ?>
< ?php endif;?>