[resolved] yet another pagination question (6 posts)

  1. sodypop
    Posted 8 years ago #

    Hey guys, i am having a pagination issue and it's something that is probably really easy, i am just not finding the answer. on my main page i am limiting the post display to just the news category, however, it is paginating for all posts no matter the category, so on some pages i have no content showing. here is my code:

    <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    <?php if ( is_page() ) { ?>
    <?php the_content(); ?>
    <?php } else { ?>
    <?php if (in_category('4') && is_home() ) continue; ?>
    <h1><?php the_date(); ?> | <?php the_title(); ?></h1>
    <?php the_content(); ?>
    <?php } ?>
    <?php endwhile; else: ?>
    Sorry, no posts matched your criteria.
    <?php endif; ?>
    <?php if(is_category()) { wp_page_numbers(); } ?>
    <?php if(is_home()) { wp_page_numbers(); } ?>

    so basically, i only want the main page (home) to paginate stuff from the category "news" (id 1). what am i missing?
    where did it all go wrong?!!

  2. sodypop
    Posted 8 years ago #

    someone help meh?

  3. Ivovic
    Posted 8 years ago #

    I swear when reading your last post, I actually heard a 1930s black and white horror-movie style scream. That was awesome, do it again :)

    you've been creative here, with your template code, but you're doing it wrong, basically.

    check out this page... use query_posts to do your exclusions, using that will respect your posts-per-page.


  4. Joni
    Posted 8 years ago #

    You SO owe me a bottle of glass cleaner and a roll of paper towels. And I intend to collect. :)

  5. Ivovic
    Posted 8 years ago #


  6. Joni
    Posted 8 years ago #

    Here's an awesome pagination plugin that I'm currently playing with. I think it may even be able to paginate by categories.

    I'll see if I can find the text file that should have some more info; it's a pretty sophisticated plugin but very powerful too.

Topic Closed

This topic has been closed to new replies.

About this Topic