WordPress.org

Forums

Query Posts By Date Range (6 posts)

  1. pgatroy
    Member
    Posted 6 years ago #

    I would like to create a template page which pulls posts from a certain category according to a specific date range.

    Can someone please provide me with the code to do this? I know how to pull certain categories but don't know how to filter by date range.

    Thank you.

  2. buddha trance
    Member
    Posted 6 years ago #

    Read this codex reference on query_posts.

    Example 2 is probably what you are looking for, then scroll down to time parameters.

  3. greggo
    Member
    Posted 6 years ago #

    Example 2 doesn't address a range, but rather just a specific date, month or year. For instance, I am using future-is-now and want to be able to retrieve the next 3 posts dated later than today. How would you do that?

  4. buddha trance
    Member
    Posted 6 years ago #

    Try with these threads about displaying future posts http://wordpress.org/tags/futureposts

    There, I found this link, which may have your solution. Maybe you can adapt the code to your needs?
    http://www.keithmillington.co.uk/wordpress/?p=22, then add &showposts=3 to limit the number of posts.

    Hope this helps.

  5. edaigh
    Member
    Posted 6 years ago #

    I need this as well. The answers posted so far are close, but don't actually address the "range" issue. All I need is a list of all the posts in all categories posted in the last seven days. can someone please help?
    thanks,
    e.

  6. MichaelH
    Member
    Posted 6 years ago #

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags