How to query for a posts of a given date or younger?

Home Forums MapPress Support How to query for a posts of a given date or younger?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #16167
    wwaytv3
    Participant

    I’m using a mashup shortcode to embed a map of posts, as below

    [mashup query="post_type=post" mashupTitle="post" mashupLink="true" mashupClick="true" mashupBody="post" poiLinks="" mapTypeId="roadmap"]

    Does anyone know how I could alter the query to do something like “return only posts less than 30 days old” ?

    #16168
    Chris
    Keymaster

    You can easily show the most recent 10 posts:
    [mashup query="post_type=any&posts_per_page=10"]

    Unfortunately, if you instead want to use a specific time (like past 30 days), WordPress really doesn’t offer a way to do this in a query string – you would need to use a PHP template tag instead. If you want to take that route please see the documentation for some examples and the WordPress Codex for info about the date parameters:

    https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters

    #16169
    wwaytv3
    Participant

    I think that will work well enough for me, thanks for the help!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.