Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #1496798

    Hi

    I’m trying to change The Events Calendar single-event.php by copying it into my child theme. However the copy of single-event.php in the Enfold theme folder seems to override this. If I change the file in the Enfold theme, it seems to work OK, but if I copy that into my child theme and change it, nothing works. Obviously I don’t want to change single-event.php in the Enfold theme folder as it will be over written when updated.

    Do you know what I need to do to add the file to the child theme to be able to over ride that page please.

    Many Thanks
    Regards
    Colin

    #1496823

    Hey waveseven,

    Thank you for the inquiry.

    To override it in the child theme, use the tribe_events_template filter with a higher priority that checks the child theme directory first. Add this in the child theme’s functions.php:

    add_filter( 'tribe_events_template', 'avf_events_template_paths_mod', 20, 2 );
    
    function avf_events_template_paths_mod( $file, $template )
    {
        $redirect = array( 'default-template.php', 'single-event.php', 'pro/map.php' );
    
        if( in_array( $template, $redirect ) )
        {
            $child_file = get_stylesheet_directory() . '/config-events-calendar/views/' . $template;
    
            if( file_exists( $child_file ) )
            {
                $file = $child_file;
            }
        }
    
        return $file;
    }
    

    Then place your modified template at:

    enfold-child/config-events-calendar/views/single-event.php
    

    Copy the original from enfold/config-events-calendar/views/single-event.php as your starting point.

    Best regards,
    Ismael

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.