Home › Forums › Calendar Products › Events Calendar PRO › "Current Month Being Viewed" Variable?
- This topic has 6 replies, 2 voices, and was last updated 13 years, 4 months ago by
Barry.
-
AuthorPosts
-
December 26, 2012 at 11:10 am #30004
Sarah
MemberWe are using a customized gridview.php for our calendar page with the calendar at the top and the list of upcoming events below that. Presently, both calendar view and events list view (modified to include thumbnails, more customizations to come) appear as so: http://www.clickinmoms.com/cmu/calendar/2013-01/
When a user selects a new month to view using the calendar dropdown, ajax/pjax reloads only the calendar and URL in the address bar. The Events List view remains the same (e.g., if we start viewing January but then select February, the February calendar comes up, but the Events List doesn’t refresh and thus continues to show January) until the user manually refreshes the page, in which case it comes up correctly.
I want to add a query posts variable to the loop in the list that queries events with a start date of equal to or greater than the month that is currently being viewed. I have the below query built but don’t know what variable to use as the “current month being viewed” (not the actual current month).
The idea is that browsing months would give the visitor the ability to see a list of upcoming events from that month (and beyond, is fine).
Thoughts:
Code:
———array(
array(
‘key’ => ‘_EventStartDate’,
‘value’ => date,
‘compare’ => ‘
———Thank you for your help!
December 26, 2012 at 11:13 am #30005Sarah
MemberSorry – the whole code didn’t make it. Should be
Code:
—array(
array(
‘key’ => ‘_EventStartDate’,
‘value’ => date,
‘compare’ => ‘
—December 27, 2012 at 7:01 am #30021Barry
MemberHi Sarah – your code didn’t quite make it there. Can you use a service like Pastebin or Gist and link back to your code? Unfortunately the forum doesn’t deal with raw code very nicely.
December 27, 2012 at 8:58 am #30031Sarah
MemberSorry about that! Here it is:
http://pastebin.com/GPrXMUEX
Thanks for your help!December 27, 2012 at 9:30 am #30032Barry
Member$GLOBALS['wp_query']->query_vars['eventDate']The above array element is basically where the date comes from so you could pull directly from that, or you could creatively use one of the Tribe API functions to provide a possible element of future proofing:
substr(tribe_get_month_view_date(), 0, 10)Does that help?
December 28, 2012 at 10:15 am #30075Sarah
MemberHey Barry! The query vars were not refreshed upon PJAX loading the new URL, but we wrote a script that looks for PJAX to finish running its commands, then executes a page refresh — so we’re all set. 🙂 Thank you!!
December 28, 2012 at 10:37 am #30076Barry
MemberExcellent 🙂
-
AuthorPosts
- The topic ‘"Current Month Being Viewed" Variable?’ is closed to new replies.
