Home › Forums › Calendar Products › Events Calendar PRO › Display two specific months of grid view on one page
- This topic has 8 replies, 4 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
July 16, 2012 at 8:25 am #22152
Kishore Hari
ParticipantHello,
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
July 16, 2012 at 4:01 pm #22165Jonah
ParticipantHi 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,
JonahJuly 17, 2012 at 12:57 pm #22220Kishore Hari
ParticipantHi 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,
DamianJuly 17, 2012 at 1:02 pm #22221Jonah
ParticipantHi 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
July 17, 2012 at 3:22 pm #22236Kishore Hari
ParticipantYep, that makes sense. I have a developer looking at it now. Thanks for the head start!
DamianJuly 18, 2012 at 7:36 am #22268Rob
MemberFantastic to hear. If you need anything else, let us know…or even if you don’t (so we can close out the thread). Cheers!
July 18, 2012 at 1:05 pm #22304Kishore Hari
ParticipantI’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
DamianJuly 18, 2012 at 7:00 pm #22332Rob
MemberDamian: 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.
July 7, 2015 at 6:25 am #977368Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Display two specific months of grid view on one page’ is closed to new replies.
