-
AuthorPosts
-
August 23, 2017 at 8:50 pm #843259
Suddenly, without changing anything to our WordPress website, a fatal error appeared on some pages. We’re using an old version (I know) of WordPress 4.1.1 and enfold theme version 3.2.3. We have planned an upgrade of our WordPress system and the Enfold theme, but for now we need to fix this error because it will take some time to upgrade our website. Hopefully you can help me.
The fatal error says:
Cannot redeclare av_upcoming_events_fallback() (previously declared in /wp-content/themes/golazo/shortcodes/events_upcoming.php:11) in /wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/events_upcoming.php
Back then another developer generated a child theme for Enfold and copied a shortcode events_upcoming.php and some functions in functions.php. In the parent Enfold theme there’s the same function av_upcoming_events_fallback() as in the child theme’s shortcode ‘events_upcoming.php’. I know that is the reason for the error, but nothing has changed to the code in the last year. Here’s the piece of code:
if (!class_exists('TribeEvents')) { function av_upcoming_events_fallback() { return "<p>Please install the <a href='https://wordpress.org/plugins/the-events-calendar/'>The Events Calendar</a> or <a href='http://mbsy.co/6cr37'>The Events Calendar Pro</a> Plugin to display a list of upcoming Events</p>"; } add_shortcode('av_upcoming_events', 'av_upcoming_events_fallback'); return; }
I have tried a few solutions (as read on this support forum) but without solutions:
– Renamed function in child theme shortcode: not working
– Wrap the function in the parent theme with if(!function_exists(‘av_upcoming_events_fallback’))
– Remove the code in child theme: not workig
– Now I have commented out the av_upcoming_events_fallback function and replaced it byif ( !class_exists( 'TribeEvents' ) ) return false;
The error is gone, but another error shows up: PHP Fatal error: Class ‘TribeEvents’ not found in wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/events_upcoming.php on line 59.
I’m not a WordPress wizard and need some help with this one. Important is that we have to fix the error with the current (old) version of WordPress and the current (old) version of Enfold. If necessary I can provide FTP and WP credentials.
Thanks in advance.
Niels VerhesenAugust 25, 2017 at 8:02 am #843775Hi Niels!
Can you please check if your developer referred to this post – http://kriesi.at/documentation/enfold/add-new-or-replace-advanced-layout-builder-elements-from-child-theme/? There should be such code in functions.php file of your child theme.
Best regards,
YigitAugust 25, 2017 at 8:16 am #843786Hi Yigit,
Thanks for yor reply. That piece of code is already in our functions.php in the child theme and there is a folder called shortcodes in our child theme with a copy of the shortcode events_upcoming.php. Still our WordPress gives the error. Maybe you can take a look in the code?
Thanks,
NielsAugust 28, 2017 at 4:38 pm #844871Hi,
Sure. Can you please post FTP and WP admin logins here privately?
Best regards,
YigitAugust 29, 2017 at 8:51 am #845232This reply has been marked as private. -
AuthorPosts
- You must be logged in to reply to this topic.