Home › Forums › Calendar Products › Events Calendar PRO › change template
- This topic has 0 replies, 2 voices, and was last updated 6 years, 1 month ago by martin75.
-
AuthorPosts
-
March 22, 2018 at 8:51 am #1485951martin75Participant
if this code work to load a custom template when on events/month
add_filter('gettext', 'tribe_custom_theme_text', 20, 3); function tribe_theme_template_chooser ( $template ) { if ( ! tribe_is_event() ) return $template; /* * Example for changing the template for the single-event page to custom-page-template.php * Template is usually set to /plugins/the-events-calendar/src/views/default-template.php * You might wish to include some things from that template in your custom one, such as * the function tribe_get_view() which helps format the content within your template. * You can modify this example to set the template for any tribe page. Month view could be * modified by instead using the tribe_is_month() condition. */ // Single event page if ( is_single() ) { $template = locate_template( 'single_event1.php' ); } if ( tribe_is_month() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template; }
then why wont this code work to do the same for maps view ??
if ( tribe_is_map() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template;
March 23, 2018 at 10:19 am #1487199CliffMemberHi again, Martin.
If I’m not mistaken, Map View actually always loads via Ajax.
Try this instead:
$is_map_view = ( tribe_is_map() || Tribe__Events__Pro__Main::instance()->is_pro_ajax_view_request( false, 'map' ) );
Please let me know how this goes for you.
March 23, 2018 at 1:52 pm #1487362martin75Participantmany thanks Cliffe i tried this , with no success
function tribe_theme_template_chooser ( $template ) { if ( ! tribe_is_event() ) return $template; /* * Example for changing the template for the single-event page to custom-page-template.php * Template is usually set to /plugins/the-events-calendar/src/views/default-template.php * You might wish to include some things from that template in your custom one, such as * the function tribe_get_view() which helps format the content within your template. * You can modify this example to set the template for any tribe page. Month view could be * modified by instead using the tribe_is_month() condition. */ // Single event page if ( is_single() ) { $template = locate_template( 'single_event1.php' ); } if ( tribe_is_month() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template; $is_map_view = ( tribe_is_map() || Tribe__Events__Pro__Main::instance()->is_pro_ajax_view_request( false, 'map' ) ); } if ( tribe_is_map() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template; add_filter( 'template_include', 'tribe_theme_template_chooser', 11 );
the code is in my themes functions.php
thanks again Cliffe
March 23, 2018 at 3:28 pm #1487415CliffMemberYou’d need to replace
tribe_is_map()
with$is_map_view
March 23, 2018 at 3:30 pm #1487422CliffMemberAnother thing to think about is that the
template_include
filter might not be the right one to use if loading via AjaxMarch 24, 2018 at 3:50 pm #1487920martin75Participanti have accepted defeat gracefully ! I have now change default template to the above template and all works fine i have changed the organizer and venue template call no problem and the single event .
for organiser and venue i have used<?php if ( is_single() && tribe_is_event_organizer() ) { get_template_part( 'organizer_template' ); return; } if ( is_single() && tribe_is_event_venue() ) { get_template_part( 'venue_template' ); return; }
both work fine.
for single page i used
`// Single event page
if ( is_single() ) {
$template = locate_template( ‘single_event1.php’ );
}
now the big question what would i use to call a different template for the tribe-ext-instructor-linked-post-type ?thought a good place to ask as you made that linked post type masterpiece!March 26, 2018 at 12:31 pm #1488892CliffMemberThanks for the thorough reply and kind words.
https://theeventscalendar.com/extensions/linked-post-type-instructors/ has its own template file, and that extension is meant to be forked (i.e. a template).
April 17, 2018 at 9:35 am #1509421Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘change template’ is closed to new replies.