WordPress.org

Ready to get started?Download WordPress

Forums

category excluded on home page throws off number of posts per page (3 posts)

  1. mkallen
    Member
    Posted 8 years ago #

    I put the following code on my home page:

    <?php if (in_category('12') && is_home() ) continue; ?>

    I wanted 10 posts to display on each page. If I have, say 2 posts from that category, only 8 are displayed on the home page. Is there any way to fix this? I am using 2.0.1.

  2. Samuel Wood (Otto)
    Tech Ninja
    Posted 8 years ago #

    mkallen: So, you're excluding a single category from your homepage. That is the most obvious way to do it, but as you found, it has drawbacks. The other way to do it is to modify the main loop query to exclude the posts you don't want to see.

    And I could go into extreme detail here, but there's really no point when there's plugins to do it all for you.

    Category Visibility: http://ryowebsite.com/?p=46

    It lets you decide which posts show up where. Very handy.

  3. mkallen
    Member
    Posted 8 years ago #

    Wow! Thanks, Otto42. That's exactly what I needed!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags