Home › Forums › Calendar Products › Events Calendar PRO › Different default template for month vs. other views
- This topic has 7 replies, 2 voices, and was last updated 11 years, 6 months ago by
Barry.
-
AuthorPosts
-
September 5, 2014 at 3:22 pm #725432
Kishore Hari
ParticipantI’d like to use the full width (default events template) for my month view and the default page template for all other views, including single-event. What’s the best way to do this? I want to minimize the overrides since this is a simple change.
Month view as I want displayed here: http://www.bayareascience.org/schedule/2014-10/
September 5, 2014 at 4:41 pm #725632Barry
MemberHi Kishore,
Great question.
There are a few ways to go about something like this – one fairly straight forward way is to override and customize the default-template.php. You can find complete instructions in the Themer’s Guide, but basically you would copy:
the-events-calendar/views/default-template.php
Then place the copy in your theme at a path something like this:
your-theme/tribe-events/default-template.php
Then, just above get_header(), you could add some code like this:
// If this is not month view, use another template if ( ! tribe_is_month() ) { get_template_part( 'page' ); return; }Would that work here?
September 5, 2014 at 5:01 pm #725683Kishore Hari
ParticipantWhat would I choose as the events template in settings then?
September 5, 2014 at 5:05 pm #725686Kishore Hari
ParticipantThe month view renders properly (http://www.bayareascience.org/schedule/2014-10/), but when I select any other view than month, my template renders a mess: http://www.bayareascience.org/schedule/map/
http://www.bayareascience.org/schedule/upcoming/September 8, 2014 at 7:41 am #730660Barry
MemberHi!
What would I choose as the events template in settings then?
Sorry for not being clearer: if you follow the approach I outlined then you would select the Default Events Template.
The month view renders properly (http://www.bayareascience.org/schedule/2014-10/), but when I select any other view than month, my template renders a mess: http://www.bayareascience.org/schedule/map/
Have you reverted your changes here/are you just using the same template for all? Both look pretty good to me – can you highlight what the problem is exactly?
Thanks!
September 8, 2014 at 9:28 am #730946Kishore Hari
ParticipantI had reverted it – still having the problem.
When I switch the to default events template and use the code provided, the month view works properly: http://imgur.com/hCWda2G
But any view except month looks like this: http://imgur.com/PN6o7bSSeptember 8, 2014 at 9:34 am #730960Barry
MemberOK – what if we reverse things and you use the Default Page Template as the default and add the following just above the get_header() call within there:
if ( tribe_is_month() ) { get_template_part( 'tribe-events/default-template' ); return; }You would also need to copy the default-template.php file and place it within a tribe-events directory inside your theme, ie:
your-theme/tribe-events/default-template.phpCertainly with a couple of default WordPress themes this approach seems to work nicely. Does that help?
September 22, 2014 at 8:01 am #758822Barry
MemberHi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!
-
AuthorPosts
- The topic ‘Different default template for month vs. other views’ is closed to new replies.
