WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] yet another pagination question (6 posts)

  1. sodypop
    Member
    Posted 6 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
    Member
    Posted 6 years ago #

    please!
    someone help meh?

  3. Ivovic
    Member
    Posted 6 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.

    http://codex.wordpress.org/Template_Tags/query_posts

  4. Joni
    Member
    Posted 6 years ago #

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

  5. Ivovic
    Member
    Posted 6 years ago #

    :D

  6. Joni
    Member
    Posted 6 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.
    http://www.mis-algoritmos.com/2007/09/09/wp-digg-style-pagination-plugin-v-10/

    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