Home › Forums › Calendar Products › Events Calendar PRO › Gridview Based On Category
- This topic has 34 replies, 7 voices, and was last updated 10 years, 9 months ago by
Support Droid.
-
AuthorPosts
-
April 24, 2012 at 5:44 pm #18258
Jonah
ParticipantHi Diane,
What I posted on 4/10 is that basically all your event category specific calendars are already there and available at http://your-url.com/events-slug/category/your-category-name/ (as long as you are showing the grid view by default).
So, I’m not sure what else you need to do with those four templates for the non-active categories. Delete them?
I guess I’m confused about the question… Can you elaborate/provide some examples that I can maybe look at?
April 24, 2012 at 5:47 pm #18259rudeetours
MemberJonah,
If you look here http://rudeetours.com/ and scroll over tours, you’ll see the four categories. Each category has a different page template started by the other developer but not coded for the categories, just the page layout. So, I need to know how to include just one specific category (or how to exclude the other three.
It’s possible I’m making this too difficult. Is there another way to get the desired results?April 24, 2012 at 6:07 pm #18260Jonah
ParticipantHi Diane,
Well, if you want to stick with that permalink structure, yes, you’ll have to use the separate pages but you could just use one page template and pass in the slug or something to a custom calendar query.
Otherwise, the easier approach would be to just use the build in category links and update the menu links for each of the tours to point to those category calendars. But, you won’t have nice URL’s then…
The former option is going to be tricky thought but basically you should be able to include the gridview conditionallly like so into your pages:
if(is_page('sample-page')) {
include( get_stylesheet_directory() . '/events/gridview.php');
}
And then you could use the pre_get_posts function to conditionally modify the query for each page. The only downside to this approach is that the calendar prev/next links are going to take you outside of your specific tour pages and back into the main calendar page, showing the previous or next month with all categories… Unfortunately there’s no easy way around this that I know of so you’ll need to play around with things to get it working right.
Another thing you could try is making your base events slug ‘tours’ and then instead of displaying the calendar on the ‘tours’ page, display your tour landing page and then for all your event sub-categories they will use ‘tours’ as the slug base so your URL’s will look more like they do now. But you’ll still have /tours/category/category-name (the category base in the slug) and I don’t know of any way to easily get rid of that either…
So, those are some options and you’ll need to play around with things a bit to get them working the way you want. Hopefully these ideas help though! Good luck!
April 25, 2012 at 10:36 am #18271rudeetours
MemberGiven your comments above, maybe it’s easier to just start over using your default category display page. However, the category templates that I need to reproduce have different content before the calendar. I see in settings > the events calendar > template that I can add html before the calendar. I would like to be able to add conditional php code so I could display different content depending on my category. It doesn’t look like I can use php there. Any ideas on how I can do this?
May 1, 2012 at 9:26 pm #18536Jonah
ParticipantAll you’ve got to do is put conditional code in /wp-content/plugins/the-events-calendar/views/gridview.php (override by placing a copy in an ‘events’ folder in your theme) to detect the category which is just a taxonomy. Gridview is the template used to display your calendar page. You should be able to use if(is_tax(‘tribe_events_cat’,’your-cat-slug-or-ID’)) {}
I hope that helps!
May 15, 2012 at 11:39 am #19194rudeetours
MemberJonah, I’m able now to turn my focus back to this project. The good news is that using your conditional statement(s) in gridview.php I was able to display different content before and after the calendar for my different categories. The bad news is that my category filtered calendars don’t seem to be working for some reason. I have four categories that should display on these four pages respectively.
http://rudeetours.com/events/category/creek-cruise-2/
http://rudeetours.com/events/category/dolphin-watching-2/
http://rudeetours.com/events/category/seabreeze-cruise-2/
http://rudeetours.com/events/category/winter-wildlife-2/
But, if you see the test events I’ve created, it shows that somehow those categories aren’t being filtered properly.
Any ideas as to why or what I can do to resolve this?May 15, 2012 at 11:48 am #19196rudeetours
MemberAlso, (assuming my categories were working), when I page to the previous month or next month, I exit my category and just go to /events/2012-04 for example. From your comments, I understood that if I used your category pages, the previous and next functionality would also reflect the category. Did I misunderstand this?
Thanks in advance for your help!May 15, 2012 at 3:28 pm #19232Rob
MemberThanks rudeetours. I’ve passed sent this Jonah’s way to make sure he sees it (the email notifications have been buggy lately) and he should be taking a look shortly.
May 16, 2012 at 1:34 pm #19272rudeetours
MemberThanks. I got it to work by going back to the basic grid.php. However, I lose my sidebars. Any idea why?
May 16, 2012 at 5:47 pm #19283Rob
MemberRudeetours: could you bring back the sidebars with a different templating option selected under Settings -> The Events Calendar?
May 17, 2012 at 8:44 am #19312rudeetours
MemberNo, I can’t get the sidebar with the calendar with any of those options.
May 17, 2012 at 4:35 pm #19353Jonah
ParticipantHi there,
Make sure events are associated with any of those 4 categories, for instance I looked at this event: http://rudeetours.com/event/dolphin-test/2012-05-15/ – and it didn’t appear to be associated with the Creek Cruise category…
I did mention the prev/next links:
“The only downside to this approach is that the calendar prev/next links are going to take you outside of your specific tour pages and back into the main calendar page, showing the previous or next month with all categories… Unfortunately there’s no easy way around this that I know of so you’ll need to play around with things to get it working right.”On the sidebar issue this is more related to your theme and how it inserts sidebars. Depending on what Events Template you have set, you’ll want to go into that template and add the sidebar however your theme adds sidebars. You’ll need to change the layout via CSS specifically for that page.
Good luck!
May 18, 2012 at 2:29 pm #19381rudeetours
MemberOk, Thanks. Most events are not categorized yet as this site is live. Once I get the categories working, we’ll update the events. I do have test events out there that are categorized for testing purposes.
I’m going to try and display the sidebar differently using widget logic. I’m having trouble figuring out which conditional statements might work as it doesn’t really recognize the “events categories” as true “post categories”. Can you tell me how I can set up my conditional statements to target my events categories?
Thanks again!May 21, 2012 at 9:28 am #19440Jonah
ParticipantHere’s a few different conditional wrappers that should help give you some ideas: https://gist.github.com/2415009
Event categories are taxonomies so you would just need to pass in the taxonomy name into the is_tax function to test for specific cats.
Good luck!
May 21, 2012 at 1:02 pm #19472rudeetours
MemberJonah,
When I view the page source for the gridview.php category pages I see that the taxonomy is “tribe_events_cat”, but I don’t see how to differentiate between the categories. -
AuthorPosts
- The topic ‘Gridview Based On Category’ is closed to new replies.
