Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1028907

    Hello. I am building a site using the Enfold Church Demo template, which carries a dependency on The Events Calendar plug-in.

    I need to modify the “single event calendar view” to inject additional custom content required for our application. However, because Enfold applies a custom modification to The Events Calendar PHP, the supported methods to override the plug-in do not work.

    I have determined that the file that needs to be modified is this one: ./enfold/config-events-calendar/views/single-event.php. We have limited our mod to a single line function call (the_showinfo), which is inserted before the main content:

    <?php echo tribe_event_featured_image($event_id, 'entry_with_sidebar', false); ?>
    <!-- Renders the CHS Show Info sidebar -->
    <?php the_showinfo(); ?>
    <?php the_content(); ?>

    Our supporting functions are safely encapsulated in our functions.php file in Enfold-Child. However, I can find no way to do the same for this one line change. Is there a way to override this entirely in our child theme? Apologies if this is a noob question; we are new to WordPress.

    Thanks in advance.

    Gary

    #1029519

    Bump?

    #1029710

    Hi,

    Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)

    Best regards,
    Basilis

    #1029725

    Hi Basilis, thanks for the reply.

    However, I just want to be sure that you fully understood my request. We are not looking for coding assistance to achieve the results we want: we already did that. Right now, our mod requires just a one-line addition to a file for The Events Calendar plug-in that your theme has customized (as I explained above).

    We are simply looking for a way to move this logic to the Enfold-Child theme to insulate us from breakage from theme updates. Is there no JavaScript you can provide that would let us safely move this modification into our own functions.php?

    Please bear in mind that The Events Calendar fully supports overriding plug-in files, and provides documentation here. However, because of the modifications by Enfold, this does not work for this particular file.

    It feels to me like you have some obligation to support customers in cases where you own modifications make it impossible to use a plug-in’s documented features properly.

    Thanks for listening.

    #1031054

    Hi,

    Thanks for the update. You should be able to override the template in your child theme but you have to remove the theme’s default template paths. Add this code in the functions.php file:

    add_action('after_setup_theme', function() {
        if(is_child_theme()) remove_action('tribe_events_template', 'avia_events_template_paths', 10, 2);
    });
    
    add_action('tribe_events_template', 'avia_events_template_paths_mod', 10, 2);
    function avia_events_template_paths_mod($file, $template)
    {
        $redirect = array('default-template.php', 'single-event.php');
        if(in_array($template, $redirect))
        {
            $file = get_stylesheet_directory() . "/tribe-events/views/".$template;
        }
    
        return $file;
    }
    

    You can now add the single-event.php file inside the child theme’s “tribe-events/views” folder.

    Best regards,
    Ismael

    #1031387

    Hi Ismael, thank you very much for this! I appreciate the support. I think you can close this topic.

    All the best,

    Gary

    #1031562

    Hi,

    Cool. Open a new thread if you need anything else. We’ll close this one now.

    Have a nice day.

    Best regards,
    Ismael

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘How to override Enfold mods to The Events Calendar in Enfold-Child?’ is closed to new replies.