WordPress.org

Forums

Display different # of posts on different pages (3 posts)

  1. dansinch
    Member
    Posted 8 years ago #

    I have been reading up on how to display posts from WP in other sections of my site and I have it pretty much working, but I'd like to be able to display different amounts of posts on different pages.

    For example, I have a News which only displays posts in the News category. The problem is, if I have WP set to display 10 posts per page, and only 1 out of the last 10 is a News post, it only displays that one.

    Is there a way I can tell it to display, say the last 10 posts in the News category regardless of how many other posts have been made recently?

    In other words, is there a way to override the default posts per page depending on certain conditions?

  2. Chris_K
    Member
    Posted 8 years ago #

  3. dansinch
    Member
    Posted 8 years ago #

    I figured out a way to show the default number of News posts, using query_posts('cat=6'); instead of the method I was using. So if I have it set to "Show at most 10 posts", it will now show the last 10 News posts and not just whatever posts happen to be News posts out of the last 10 total posts. If that makes sense.

    So that's a little better than what I had before, but I'd still like to have more control. So I tried this plugin, but it doesn't seem to work on pages outside of WP. I set the News category to show 5 posts, which works fine if I go into the News category in the Blog section. But on the News page (which is using The Loop to pull News posts) it's still showing 10.

    Any way around that? Do I have to define the news page as a category page or something first?

Topic Closed

This topic has been closed to new replies.

About this Topic