Display two specific months of grid view on one page

Home Forums Calendar Products Events Calendar PRO Display two specific months of grid view on one page

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #22152
    Kishore Hari
    Participant

    Hello,

    I need to accomplish a very specific thing — two months of grid view on one page. I need to display October and November 2012, in grid view, on one WordPress page.

    I understand that I’ll have to use template tags to accomplish this, but I haven’t been able to find the code to output specific months in grid view… yet.

    Any help is much appreciated.

    Thanks,

    Damian

    #22165
    Jonah
    Participant

    Hi Damien,

    The only thing I can think of off the top of my head to get this to work is by using pre_get_posts to modify the query on page and set an end and start date for a span of two months. Here is an example of using pre_get_posts:

    add_action( 'pre_get_posts', 'show_two_months_of_events' );
    function show_two_months_of_events( $query ) {
    $current_date = date('j M Y', strtotime('1 month ago'));
    $end_date = date('j M Y', strtotime('1 month'));

    if ( $query->query_vars['eventDisplay'] == 'month' && $query->query_vars['post_type'] == TribeEvents::POSTTYPE && !is_tax(TribeEvents::TAXONOMY) && empty( $query->query_vars['suppress_filters'] ) ) {
    $query->set('start_date', $current_date);
    $query->set('end_date', $end_date);
    }
    return $query;
    }

    You might need to modify that a bit. The condition is to only set the query vars on the month view so if you’re displaying this in a page or post you’ll need to change the condition or add your own. Outside of that this is going to be fairly complex to set and we cannot assist with that level of customization. Hopefully this gets you going in the right direction though.

    Cheers,
    Jonah

    #22220
    Kishore Hari
    Participant

    Hi Jonah,
    Thanks for the info.
    Do I paste this code into gridview.php, or a different file?
    I do need to display this in a custom page template in WordPress, but it can be hard coded into the template if that makes things easier.
    Thanks,
    Damian

    #22221
    Jonah
    Participant

    Hi Damien,

    The above code would go into your theme’s functions.php file but it’s only going to work if you already have a page with the calendars setup where you can modify the query with this function. Unfortunately we cannot help out with this level of customization and you will either need to figure it out on your own or hire a developer to work with you.

    Good luck!

    – Jonah

    #22236
    Kishore Hari
    Participant

    Yep, that makes sense. I have a developer looking at it now. Thanks for the head start!
    Damian

    #22268
    Rob
    Member

    Fantastic to hear. If you need anything else, let us know…or even if you don’t (so we can close out the thread). Cheers!

    #22304
    Kishore Hari
    Participant

    I’m still waiting for a developer to take a look. Might start looking elsewhere soon.
    Do people typically reach out to devs on this site, or take that somewhere else? I looked around but did not see a ‘marketplace’ here.
    Thanks
    Damian

    #22332
    Rob
    Member

    Damian: there admittedly isn’t much on that front, but we have seen value in it from folks like yourself and I think we’re going to get something along those lines up. In the interim you may want to post a thread here just saying what you’re looking for and seeing if other users can respond.

    Hope that helps and sorry I couldn’t offer up more. Let me know what else you need.

    #977368
    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 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Display two specific months of grid view on one page’ is closed to new replies.