Home › Forums › Calendar Products › Events Calendar PRO › Category selection or category widget
- This topic has 9 replies, 4 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
November 23, 2012 at 7:19 am #28392
bikoa
ParticipantHi;
We need to filtrate events by category. There are 2 options: In the main calendar, add another select bar with different categories or add a widget with events categories.
Another question: is posible to show the event category in the calendar pop-up?
Thanks!!!!
November 23, 2012 at 8:56 am #28399Jonah
ParticipantHi Bikoa,
You can easily add a list of categories that people can click on anywhere on your website with the following snippet: https://gist.github.com/2019513 – you could put this at the top of your calendar page by making a copy of /wp-content/plugins/the-events-calendar/views/gridview.php and placing in an ‘events’ folder in your theme. You’ll need to apply whatever styling you want to the category bar to get it to look the way you want.
To affect the calendar popup you’ll need to make a copy of /wp-content/plugins/the-events-calendar/views/table.php and place in an ‘events’ folder in your theme. You can get the event categories using the following snippet: https://gist.github.com/2967263 – place that around line 136 in table.php to add the category for the event in the popup.
I hope that helps!
– Jonah
November 26, 2012 at 10:48 am #28471bikoa
ParticipantHi Jonah!
Your tips where very useful, but we have another problem:
– How can we show past events categories? It is to make simpliest category navigation.
– How can we show private events categories?Thanks, thanks, thanks!!!
November 26, 2012 at 12:18 pm #28477Jonah
ParticipantHi Bikoa,
That is a little more advanced and not something I will be able to help you with but basically you would need to do a double query, first querying events by past and by category and then from those results get the categories for those events. To query events you can either use our built in tribe_get_events() function (https://theeventscalendar.com/support/documentation/the-events-calendar-template-tags-general-functions/#functiontribe_get_events) or WP_Query querying for the ‘tribe_events’ post type.
I hope that helps but let me know if you have any other questions.
Thanks,
JonahNovember 30, 2012 at 6:18 am #28747Darius
ParticipantQuick question, Jonah… how do I tweak this if I want the category to show up even if there is no upcoming event in the category?
November 30, 2012 at 7:48 am #28761Jonah
ParticipantHi Darius,
You’ll want to first query the category using get_terms() (http://codex.wordpress.org/Function_Reference/get_terms) and then your posts query within that. Here is a sample of some code that should help you: http://snippi.com/s/3a1eh1q
I hope that helps!
– Jonah
November 30, 2012 at 12:02 pm #28772Darius
ParticipantI’m not sure if I was supposed to do something extra to the code you provided but it seems to be doing the same thing as the snippet of code found here: https://gist.github.com/2019513 – except that it adds “Upcoming Events” to the output and uses that for the link instead of the name of the category.
It seems the only way the category shows up is if there has been an event added to that category. Categories that have not had events added to it yet don’t show up.
That being said, the category does show if that event has passed as long as it hasn’t been moved to the trash. HOWEVER, when I click that category, it shows the category heading and category list twice. Here’s how I edited my list.php file – http://snippi.com/s/a5cdxwp
November 30, 2012 at 12:58 pm #28775Darius
ParticipantOkay… disregard my issue – I’m going to take the route of hard coding the category list with HTML using the category slugs as found here: https://theeventscalendar.com/support/forums/topic/displaying-all-events-in-a-category-in-events-list-view/ This basically gives me exactly what I wanted. (I think) LOL.
November 30, 2012 at 3:23 pm #28778Jonah
ParticipantHi Darius, sounds good, let us know if there’s anything else we can do for you.
– Jonah
July 7, 2015 at 6:26 am #978263Support 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 ‘Category selection or category widget’ is closed to new replies.
