Mini Calendar: Click month, display events from that month

Home Forums Calendar Products Events Calendar PRO Mini Calendar: Click month, display events from that month

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #30053
    Will
    Participant

    Hello! Happy Holidays!
    Our calendar is only to be displayed as an events list; we won’t ever show the grid calendar display. However, we’re using the mini calendar to allow users to browse through each month’s worth of events.

    One of my client’s requirements: make the mini-calendar Month/Year title a link. When clicked, load a page in that displays the Events List, limited just to that month. (Doesn’t need to be AJAX). Best case: reset the list.php view to query just that month using a uri query.

    I’ve looked over the tribe_get_events() function, so I can see how that could be used to modify the query, should I need to create a new page template for this (or set up an if statement). I’ve also switched to a month view by entering /calendar/YYYY-MM at the end of my uri, but that brings up the grid, and I can’t see any way of forcing that to display the list view.

    I know I can set up an anchor on the mini-calendar month that evaluates the text and sets up a link, that seems easy. However, what I’m not sure how to do is set that link to load the events list view displaying only that month. I’d assume I’d want to throw the YYYY-MM into the url, but how do I then force the page not to show the calendar grid view? Or, if I create a custom page to do this, how do I get it to show up within the permalink structure that the rest of the calendar shares to avoid confusing users?

    Thanks!

    #30054
    Will
    Participant

    OK, added the link around the date: http://snippi.com/s/nmua7u4 –note that you’ll need to update your styles a bit as well to make this look right.

    Beyond this, all I can think to do now is to completely blowout the gridview.php file and rewrite it with my own query, mimicking the customizations I’ve done to the list.php file. OR, write a jquery function that hides all the months except the current one, except that I’d also then need to tie into the next and previous ajax functions and reset that function. Argh…

    #30055
    Will
    Participant

    Well, I took the easy way out and replaced the function calling the grid in gridview.php with the loop in list.php.

    The downside to this is that now if I make a change in one, I need to make a change in the other. Kind of aggravating. I’d love to know if there’s a way to reroute the page back to list.php if the year and month are in the uri.

    #30056
    Will
    Participant

    Oops, I just realized I could have made my link more elegant in tribe-mini.php. Here’s a new snippi: http://snippi.com/s/v7r5ose

    #30067
    Barry
    Member

    Adding some code like this to your theme’s functions.php file (or a suitable plugin) should allow for the upcoming events list to function as a month-specific list view where URLs like xyz.com/events/upcoming/2013-02/ are received.

    Does that get you any closer at all?

    #30068
    Barry
    Member

    Actually, I’ve cleaned that code up a little.

    #30080
    Will
    Participant

    Let’s see… so it’s parsing the path for ‘upcoming’, and if the date is located after it… got it. Very cool. I just need to rewrite my anchor tag to add in the /upcoming/ into the path and it works—though I’m going to leave my altered gridview in just in case someone clicks a day, then shortens the url to show just the month.

    This is very cool. Thanks very much!!!

    #30083
    Barry
    Member

    No problem at all, glad to help 🙂

    For what it’s worth – and this may all be rather academic anyway – I think the “correct” way to do it would indeed be to adapt the existing month view, perhaps by parsing the URL for an optional display-as-list slug, or whatever is appropriate, and load in a list style template instead of the gridview.

    Then again this approach (looking for a yyyy-mm component at the end of an upcoming events request) is a simple way to reuse the existing upcoming events view and all that stuff – but please note I haven’t factored in possible problems such as pagination where a particular month contains a ton of events.

    #30084
    Will
    Participant

    Honestly, sometimes I feel like half of my development time is spent trying to figure out which of the 20 possible ways of doing something will be the “correct” one, so I’m actually happy to read that. I was just about to open a new thread about how to do something, where half of it really is just trying to get a feel for the “best” way.

    I’ve lucked out in this situation where my client gave very very specific scope around the calendar: no paging, no grid view, so I have lucked out in that sense. And, considering that the public view templates are all able to be customized in the child theme folder, it’s easy to just hijack them to cover all bases.

    Anyway, I wouldn’t have come up with this solution without having to go through a ton of the back-end TEC code to find the functions to filter, so this helps a bunch.

    #30110
    Barry
    Member

    Cool. I’ll close this thread now since I think we’re all sorted here, feel free to open a new thread if required though.

    #978360
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 11 posts - 1 through 11 (of 11 total)
  • The topic ‘Mini Calendar: Click month, display events from that month’ is closed to new replies.