Tagged: church demo, the events calendar
-
AuthorPosts
-
November 1, 2018 at 5:18 pm #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
November 3, 2018 at 8:41 pm #1029519Bump?
November 4, 2018 at 11:35 pm #1029710Hi,
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,
BasilisNovember 5, 2018 at 2:07 am #1029725Hi 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.
November 8, 2018 at 2:31 am #1031054Hi,
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,
IsmaelNovember 8, 2018 at 9:39 pm #1031387Hi Ismael, thank you very much for this! I appreciate the support. I think you can close this topic.
All the best,
Gary
November 9, 2018 at 6:30 am #1031562 -
AuthorPosts
- The topic ‘How to override Enfold mods to The Events Calendar in Enfold-Child?’ is closed to new replies.