- This topic has 5 replies, 2 voices, and was last updated 1 year, 7 months ago by
Leo.
-
AuthorPosts
-
November 20, 2020 at 11:09 am #1539342
perlfan
Hi,
So I realized that I need to secure my additional css and functions.php alterations if I don’t want to loose them when updating. Therefore I copied the additional CSS (added in customizer) to a Simple CSS plugin. After that I copied the custom php from my functions.php to a code snippet. Then I got a Fatal error and had to restore my site (before that I had tried to install a child theme and copy the custom php from my functions.php to the functions.php of the child theme, but that didn’t work either). What I’m missing are simple instruction how to secure functions.php alterations correctly. Thanks for help. FrankThe error:
Fatal error: Cannot redeclare woocommerce_template_product_reviews() (previously declared in /var/www/web41/html/belaubigteuebersetzung/wp-content/plugins/code-snippets/php/snippet-ops.php(446) : eval()’d code:63) in /var/www/web41/html/belaubigteuebersetzung/wp-content/themes/generatepress/functions.php on line 162November 20, 2020 at 12:09 pm #1539401Leo
StaffCustomer SupportHi there,
I believe that error is saying that you are using
woocommerce_template_product_reviews()
twice.Can you disable Code Snippets before activating the child theme?
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 23, 2020 at 9:47 pm #1543479perlfan
Hi Leo, thanks for your answer. Now I copied piece by piece from the main functions.php to the child functions.php. It works – except when I copied the last piece, I get a fatal error when opening the child functions.php. When I copy the code piece back to the main functions.php, the site works again (without an error). I know that it is a redeclare error, but the main functions.php is the default version without any custom code in it, so no chance to redeclare. The code which triggers the error is below the error message. Why is the child functions.php not able to process the code correctly? Thanks, Frank
Fatal error: Cannot redeclare wpf_dev_math_captcha_settings() (previously declared in /var/www/web41/html/belaubigteuebersetzung/wp-content/themes/generatepress_child/functions.php:85) in /var/www/web41/html/belaubigteuebersetzung/wp-content/themes/generatepress/functions.php on line 151
function wpf_dev_math_captcha_settings( $settings ) { /* Default settings array( 'min' => 1, 'max' => 15, 'cal' => array( '+', '*' ), ); */ // Change max number 4 for easier math $settings['max'] = 4; $settings['cal'] = '+'; return $settings; } add_filter( 'wpforms_math_captcha', 'wpf_dev_math_captcha_settings' );
November 23, 2020 at 10:03 pm #1543494Leo
StaffCustomer SupportHave you checked with WP Forms support team on this?
I’m not familiar with that code.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/November 23, 2020 at 11:59 pm #1543617perlfan
Ok, I’ll try to resolve with them. Thanks, Frank
November 24, 2020 at 9:31 am #1544686Leo
StaffCustomer SupportNo problem 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.