"Current Month Being Viewed" Variable?

Home Forums Calendar Products Events Calendar PRO "Current Month Being Viewed" Variable?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #30004
    Sarah
    Member

    We 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!

    #30005
    Sarah
    Member

    Sorry – the whole code didn’t make it. Should be

    Code:

    array(
    array(
    ‘key’ => ‘_EventStartDate’,
    ‘value’ => date,
    ‘compare’ => ‘

    #30021
    Barry
    Member

    Hi 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.

    #30031
    Sarah
    Member

    Sorry about that! Here it is:
    http://pastebin.com/GPrXMUEX
    Thanks for your help!

    #30032
    Barry
    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?

    #30075
    Sarah
    Member

    Hey 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!!

    #30076
    Barry
    Member

    Excellent 🙂

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘"Current Month Being Viewed" Variable?’ is closed to new replies.