Different default template for month vs. other views

Home Forums Calendar Products Events Calendar PRO Different default template for month vs. other views

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #725432
    Kishore Hari
    Participant

    I’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/

    #725632
    Barry
    Member

    Hi 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?

    #725683
    Kishore Hari
    Participant

    What would I choose as the events template in settings then?

    #725686
    Kishore Hari
    Participant

    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/
    http://www.bayareascience.org/schedule/upcoming/

    #730660
    Barry
    Member

    Hi!

    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!

    #730946
    Kishore Hari
    Participant

    I 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/PN6o7bS

    #730960
    Barry
    Member

    OK – 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.php

    Certainly with a couple of default WordPress themes this approach seems to work nicely. Does that help?

    #758822
    Barry
    Member

    Hi! 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!

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Different default template for month vs. other views’ is closed to new replies.