Home › Forums › Calendar Products › Events Calendar PRO › Customizing the gridview
- This topic has 9 replies, 3 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
April 6, 2013 at 10:27 am #45075
Ken
ParticipantHi! I just updated from The Events Calendar 1.6.5 to 2.0.11 PRO. I have two questions about the calendar grid:
• Can I exclude a certain category of events from the gridview?
• How can I make the gridview span the entire width of the page? That is, I want to remove my theme’s vertical navbar on that one page. Is that possible?
April 8, 2013 at 10:44 am #45220Jonah
ParticipantHi Ken,
You can use something like this to exclude events: https://gist.github.com/jo-snips/5338806 – that will modify the query on the various event pages. Make sure to change the category to what you need.
To get the calendar full width, the easiest way might be to change the Event Template setting in Events > Settings > Template to a full width template if your theme has one. Otherwise you are going to need to modify the CSS and possibly HTML to adjust things.
Does that help?
April 8, 2013 at 6:46 pm #45279Ken
ParticipantJonah,
Thank you for the helpful reply! I thought I had done full-page templates before, but I couldn’t quite remember how. Your suggestion jogged enough of my memory that I was able to do it now. 🙂
Thanks also for the Github code. Could you help me understand how to implement it? I presume I change TAXONOMY to the ID corresponding to the category I want to exclude. But where do I put this file, and how do I call it?
-Ken
April 8, 2013 at 6:54 pm #45280Ken
ParticipantJonah,
A brief follow-up: changing the Events > Settings > Template to a full width template affects not only the gridview, but also the individual event listings as well. I don’t see that I can change this with a custom gridview.php file, as my theme sets the content width prior to that file being called. How do I change just the gridview template’s width and nothing else?
-Ken
April 9, 2013 at 7:46 am #45338Jonah
ParticipantHi Ken,
For the github code you would put that in your theme’s function.php file and change the ‘terms’ parameter to the slug of the category you want to exclude. You’ll also want to change the ‘operator’ to ‘NOT IN’ if you want to exclude a particular category.
To achieve the full width template only for the grid this is kind of tricky but definitely doable. I would suggest using one of the templates with a sidebar and then for the gridview, adding some CSS to hide the sidebar and make everything full width. To help with this, you can specifically target the gridview page with the .events-gridview body class. So in your CSS you would use something like this to hide your sidebar:
.events-gridview #sidebar {
display: none;
}
Then, you just need to modify the container widths on the page in a similar way. I would need to look at your code with the chosen template in place to tell you for sure what to do. If you want to apply the template you’re going to use I can take a look and give you a better idea of the CSS to apply to get the page full width.Does that help?
April 9, 2013 at 8:48 am #45359Ken
ParticipantJonah,
Thanks for the clear explanations! My calendar is now excluding a particular category. Is there a way to make this behavior occur on the gridview only, and not the event listings?
I’ll try the full width adjustment next…
-Ken
April 9, 2013 at 9:51 am #45369Jonah
ParticipantHi Ken,
Yes, you just need to modify the condtional to not include ‘upcoming’ or ‘past’ like so:
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( 'tax_query', array(
array(
'taxonomy' => TribeEvents::TAXONOMY,
'field' => 'slug',
'terms' => array('2012'),
'operator' => 'IN'
)
)
);
}
April 9, 2013 at 9:58 am #45376Ken
ParticipantIt works! 😀
April 9, 2013 at 2:52 pm #45419Jonah
ParticipantGlad to hear Ken! Let us know if there’s anything else you need help with.
July 7, 2015 at 6:26 am #978925Support 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 ‘Customizing the gridview’ is closed to new replies.
