• sundrop

    (@sundrop)


    I would like to change my front page in one small way. I would like one category to be limited to one post on the front page, while other categories are handled in the typical way.

    I would then have 10 recent posts on the front page, from the various categories, except one particular category (“Daily News Digest”) will have only (at most) one post in those 10 recent posts.

    So even if the Daily News Digest category might have 3 or 5 or 12 of the most recent posts to the blog, the blog’s front page would display only one post from the Daily News Digest category along with nine other posts from other categories.

    I wonder if I have seen a plug-in that would handle this but I can’t find it now if I have.

    Suggestions, anyone?

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter sundrop

    (@sundrop)

    The issue: Posting ten posts on the front page, but have one category that is only allowed one post among those ten.

    The best I have come up with so far:

    This is ugly… but… the category in question (“Daily News Digest”) is typically posted once a day first thing in the morning.

    The best I have come up with is to run the loop twice.

    1. The first time the loop looks for posts from today only (probably includes one from the “Daily News Digest” category).
    2. The second time the loop looks for posts not from today and excludes that one category.

    I don’t know how to do that in a way that would control for the number of posts on the front page. I could set a number of posts for the second query, say… 8. But we wouldn’t know how many posts the first query would turn up, so the front page would have 8 to 13 or so posts.

    As I say, this feels like a kludge.

    Does anyone have a better thought on this?

    If it helps, you can see the website, Doc’s Political Parlor, to get a sense of what I am talking about.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    There is probably no way to do what you want without significant changes to the core code. I can’t think of a simple way to do it in straight SQL, much less trying to get wordpress to do it as part of the normal loop.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to limit one category (but not all categories) on front page?’ is closed to new replies.