WordPress.org

Ready to get started?Download WordPress

Forums

Usage of query_posts (3 posts)

  1. sumeetjain
    Member
    Posted 8 years ago #

    I'm trying to set up a blog where the front page shows only the posts made related to a certain topic. There are a couple ways I can do this.

    One way involves a time-based query. One topic will be covered each week, so if I could somehow limit the posts displayed to only those in the week, it'd be fine. The only complication is that I can't do a simple 7-day filter, because posts from two categories will be shown when it's the middle of the week.

    Another way is to use a category-based query. All the posts in a topic will share a category, since the author is making each category as he begins each week. But I need a way to limit the posts to the newest category created.

    Can anyone think of a way to achieve either of these limits?

  2. Dgold
    Member
    Posted 8 years ago #

    1 idea

    Show only 1 post on the home page (limit to 1 post)
    Install Sticky/Adhesive plugin

    Always make 1 post in the new category which is your "index/intro" post. Make it sticky so it stays home-page all week. Change it each Monday.

    Edit this post to point (in the body, with links, kind of a Table Of Contents) to all further posts throughout the week. Could even do this w/ a function calling a list of headlines of other posts in "same category" as the sticky'd post.

  3. Kafkaesqui

    Posted 8 years ago #

    Some stuff that may help figure out your another way:

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

    Plugin for limiting front page to specific categor[y|ies]:
    http://dev.wp-plugins.org/file/front-page-cats/trunk/front_page_cats.php

    These would all need to be managed manually. For the first option though (using query_posts() with a category parameter), if you come up with category names that follow some specific, repeating pattern, then there may be a way to automate it.

    For keeping the front page down to weekly (starting on a specific day), I'll see if I can think through some sort of initial query that can be passed to query_posts().

Topic Closed

This topic has been closed to new replies.

About this Topic