Reply To: Mashup shortcde not limiting no post per page

Home Forums MapPress Support Mashup shortcde not limiting no post per page Reply To: Mashup shortcde not limiting no post per page

#18453
Chris
Keymaster

Hi,

I don’t see anything wrong with the shortcode, so my guess is the Views plugin is using its own internal query to generate the list.  You can ask the Views developer if there’s a way to set the global $wp_query, which would make that query data available to MapPress and other plugins.

Alternatively, you can use the map POI list.  That brings us to your original question about how to specify ‘today or later’ in the query string.  WordPress supports date queries using a date_query array (see here for details).  For example, to show everything since yesterday the query would be:

query="date_query[0][after]=now-1day"

Unfortunately, WordPress strips out braces inside shortcodes, so the above won’t work in the [mashup] shortcode.  A workaround is to use the HTML codes %5b and %5d instead of brackets:

[mashup query="date_query%5b0%5d%5bafter%5d=now-1day"]

That’s hard to read, and I often get questions about this, so I’ve added a patch to MapPress to allow curly braces instead (if you’d like to try the patch, please send a login and I’ll install it for you to test).  With the patch installed, the shortcode would be:

[mashup query="date_query{0}{after}=now-1day"]

Also – if you search for posts with future dates, I think WordPress will only show private posts owned by the current user.  So you may need to add the ‘future’ status to the query:

[mashup query="post_status=publish,future&date_query{0}{after}=now-1day"]