- This topic has 24 replies, 4 voices, and was last updated 3 years, 11 months ago by
David.
-
AuthorPosts
-
April 15, 2022 at 3:33 am #2189507
Yolanda
Hello support,
A few months ago I’ve posted this issue see, https://generatepress.com/forums/topic/white-screen-after-gp-update/
I needed some time to do some testing.This morning I’ve disabled all plugins and activated the Generate Press update.
I got this E-Compile-Error again, and my site was offline and I couldn’t access the admin anymore. Luckily I had made a backup on my hosting account.I’ve recorded everything on https://www.screencast.com/t/upR2GHaHtqy
I don’t know what I’m doing wrong or what is creating this error.
Can you please help me with this?
My site is https://yolandalooptdoor.yory.nl/I have purchased the premium version.
Thank you!
YolandaApril 15, 2022 at 5:06 am #2189578David
StaffCustomer SupportHi there,
what happens if you disable the Child Theme ?
April 15, 2022 at 9:36 am #2190021Yolanda
If I active the regular GP theme, and I re-load my site, I’m getting a white screen with an error, with a link to
https://wordpress.org/support/article/faq-troubleshooting/When I switch back to the child theme, the site is normal again (so still a theme update to run…)
Update: I’ve de-activated all plugins, switched to the normal theme, made the update, with the same crash as a result…
And this is the information in the WordPress email:
An error has occured E_COMPILE_ERROR on rule number 20 on /home/pcew159235/domains/yory.nl/public_html/yolandalooptdoor/wp-content/themes/generatepress/inc/theme-functions.php. Error: Cannot redeclare generate_get_option() (previously declared in /home/pcew159235/domains/yory.nl/public_html/yolandalooptdoor/wp-content/themes/generatepress/inc/theme-functions.php:20)April 15, 2022 at 8:18 pm #2190262Tom
Lead DeveloperLead DeveloperHi there,
That’s strange, the error is referencing itself.
Have any code changes been made to the parent theme on your site? If so, you may need to re-install it manually.
Let us know 🙂
April 16, 2022 at 6:08 am #2190504Yolanda
Hello Tom,
No, I haven’t changed any code, only added some CSS.
How do I install it manually?
I’ve searched for some instructions on the GP site but couldn’t find any.
Or can I uninstall the theme and than add it again via the theme dashboard?April 16, 2022 at 7:58 am #2190759David
StaffCustomer SupportYou can download the theme from here and then upload it from the Dashboard themes area, WP will replace the existing one.
April 16, 2022 at 9:45 am #2190813Yolanda
Hello David,
Well, this is becoming a very frustrating case. I had to re-install my backup multiple times…
My last attempt: I have…– disabled all plugins.
– uploaded the GP theme and activated it.
– activated all plugins again (one by one, and checking the site, one by one)
– activated the child theme… And then the site broke down again, with the same error code as I’ve send previously.So I’m setting back my backup for the 10th time now….
Not using the child theme is not what I want because of all the changes I’ve made.
It seems I’m in a loop. I don’t know what to do anymore!
Do you have any other suggestions?Ps.
My child theme style.css is empty (except for the instructionsblock)
My child theme functions.php has the following:<?php
/**
* GeneratePress.
*
* Please do not make any edits to this file. All edits should be done in a child theme.
*
* @package GeneratePress
*/if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}// hide UAG template banner
add_filter( ‘ast_block_templates_disable’, ‘__return_true’ );// Set our theme version.
define( ‘GENERATE_VERSION’, ‘3.0.3’ );if ( ! function_exists( ‘generate_setup’ ) ) {
add_action( ‘after_setup_theme’, ‘generate_setup’ );
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* @since 0.1
*/
function generate_setup() {
// Make theme available for translation.
load_theme_textdomain( ‘generatepress’ );// Add theme support for various features.
add_theme_support( ‘automatic-feed-links’ );
add_theme_support( ‘post-thumbnails’ );
add_theme_support( ‘post-formats’, array( ‘aside’, ‘image’, ‘video’, ‘quote’, ‘link’, ‘status’ ) );
add_theme_support( ‘woocommerce’ );
add_theme_support( ‘title-tag’ );
add_theme_support( ‘html5’, array( ‘search-form’, ‘comment-form’, ‘comment-list’, ‘gallery’, ‘caption’, ‘script’, ‘style’ ) );
add_theme_support( ‘customize-selective-refresh-widgets’ );
add_theme_support( ‘align-wide’ );
add_theme_support( ‘responsive-embeds’ );add_theme_support(
‘custom-logo’,
array(
‘height’ => 70,
‘width’ => 350,
‘flex-height’ => true,
‘flex-width’ => true,
)
);// Register primary menu.
register_nav_menus(
array(
‘primary’ => __( ‘Primary Menu’, ‘generatepress’ ),
)
);/**
* Set the content width to something large
* We set a more accurate width in generate_smart_content_width()
*/
global $content_width;
if ( ! isset( $content_width ) ) {
$content_width = 1200; /* pixels */
}// This theme styles the visual editor to resemble the theme style.
add_editor_style( ‘assets/css/admin/editor-style.css’ );
}
}/**
* Get all necessary theme files
*/
$theme_dir = get_template_directory();require $theme_dir . ‘/inc/theme-functions.php’;
require $theme_dir . ‘/inc/defaults.php’;
require $theme_dir . ‘/inc/class-css.php’;
require $theme_dir . ‘/inc/css-output.php’;
require $theme_dir . ‘/inc/general.php’;
require $theme_dir . ‘/inc/customizer.php’;
require $theme_dir . ‘/inc/markup.php’;
require $theme_dir . ‘/inc/typography.php’;
require $theme_dir . ‘/inc/plugin-compat.php’;
require $theme_dir . ‘/inc/block-editor.php’;
require $theme_dir . ‘/inc/class-theme-update.php’;
require $theme_dir . ‘/inc/deprecated.php’;if ( is_admin() ) {
require $theme_dir . ‘/inc/meta-box.php’;
require $theme_dir . ‘/inc/dashboard.php’;
}/**
* Load our theme structure
*/
require $theme_dir . ‘/inc/structure/archives.php’;
require $theme_dir . ‘/inc/structure/comments.php’;
require $theme_dir . ‘/inc/structure/featured-images.php’;
require $theme_dir . ‘/inc/structure/footer.php’;
require $theme_dir . ‘/inc/structure/header.php’;
require $theme_dir . ‘/inc/structure/navigation.php’;
require $theme_dir . ‘/inc/structure/post-meta.php’;
require $theme_dir . ‘/inc/structure/sidebars.php’;April 16, 2022 at 8:15 pm #2191038Tom
Lead DeveloperLead DeveloperAha, that’s the issue. Your child theme
functions.phpfile should only have this in it by default:<?php /** * GeneratePress child theme functions and definitions. * * Add your custom PHP in this file. * Only edit this file if you have direct access to it on your server (to fix errors if they happen). */Then you would add any custom functions to it (if you have any).
If your child theme doesn’t have any custom code, you can start fresh with the blank child theme here: https://generatepress.com/api/themes/generatepress_child.zip
Hope this helps!
April 17, 2022 at 2:21 am #2191153Yolanda
Hello Tom,
I’m very confused now.
What’s the use of an empty functions.php in the child theme? And then add code again?
So, at the end, I’d have the same file as shown above.
If I empty this php file the layout of my whole site (as I prefer and build it) would be lost.April 17, 2022 at 2:26 am #2191155Yolanda
And, if I empty the functions.php file in the child theme, I’m getting this error
Je wijzigingen in de PHP-code zijn teruggedraaid vanwege een fout op regel 20 in het bestand wp-content/themes/generatepress_child/header.php. Los dit op en probeer opnieuw op te slaan.
Uncaught Error: Call to undefined function generate_do_microdata() in wp-content/themes/generatepress_child/header.php:20
Stack trace:
#0 wp-includes/template.php(770): require_once()
#1 wp-includes/template.php(716): load_template(‘/home/pcew15923…’, true, Array)
#2 wp-includes/general-template.php(48): locate_template(Array, true, true, Array)
#3 wp-content/themes/generatepress/page.php(17): get_header()
#4 wp-includes/template-loader.php(106): include(‘/home/pcew15923…’)
#5 wp-blog-header.php(19): require_once(‘/home/pcew15923…’)
#6 /home/pcew159235/domains/yory.nl/public_htAnd this is the header file
<?php
/**
* The template for displaying the header.
*
* @package GeneratePress
*/if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset=”<?php bloginfo( ‘charset’ ); ?>”>
<link rel=”profile” href=”https://gmpg.org/xfn/11″>
<?php wp_head(); ?>
</head><body <?php body_class(); ?> <?php generate_do_microdata( ‘body’ ); ?>>
<?php
/**
* wp_body_open hook.
*
* @since 2.3
*/
do_action( ‘wp_body_open’ );/**
* generate_before_header hook.
*
* @since 0.1
*
* @hooked generate_do_skip_to_content_link – 2
* @hooked generate_top_bar – 5
* @hooked generate_add_navigation_before_header – 5
*/
do_action( ‘generate_before_header’ );/**
* generate_header hook.
*
* @since 1.3.42
*
* @hooked generate_construct_header – 10
*/
do_action( ‘generate_header’ );/**
* generate_after_header hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header – 10
*/
do_action( ‘generate_after_header’ );
?><?php
/**
* generate_inside_site_container hook.
*
* @since 2.4
*/
do_action( ‘generate_inside_site_container’ );
?><?php
/**
* generate_inside_container hook.
*
* @since 0.1
*/
do_action( ‘generate_inside_container’ );April 17, 2022 at 4:06 am #2191204David
StaffCustomer SupportHi there,
what Tom meant is you ONLY add your Custom Functions to the Child Theme functions.php – DO NOT copy the functions from the Parent Theme functions.php
April 17, 2022 at 4:27 am #2191213Yolanda
Hello David,
I’ve never done that. So I’m surprised it’s there.
But when I remove it, my site crashes again.April 17, 2022 at 6:51 pm #2191765Tom
Lead DeveloperLead DeveloperHi Yolanda,
What’s the purpose of your child theme, exactly? Have you had a developer go in and add a bunch of code to the theme, or have you created your site using options in the Customizer and editor (without ever touching code)? If you’ve never touched the code, the child theme shouldn’t be necessary at all. The options you set in the Customizer and in your content do not rely on the child theme.
For example:
wp-content/themes/generatepress_child/header.php:20What’s the purpose of this
header.phpfile in your child theme? Have changes been made to it, or is it identical to the parent themeheader.phpfile?The root of the issue here is that your child theme
functions.phpfile is including files that the parent theme is already including. This is causing the PHP error as you’re trying to include the same functions more than once.Error: Cannot redeclare generate_get_option() (previously declared in /wp-content/themes/generatepress/inc/theme-functions.php:20)The
functions.phpfile in a child theme is reserved only for custom functions. It should not contain anything found in the parent themefunctions.phpfile. WordPress explains it here: https://developer.wordpress.org/themes/advanced-topics/child-themes/#using-functions-phpIf you’d like to provide temporary login details in the Private Information area I’d be happy to take a look at your child theme to see if it’s set up correctly. The fact that it’s crashing your site means something within it is misconfigured and needs to be fixed.
Let me know 🙂
April 18, 2022 at 9:06 am #2192547Yolanda
Hello Tom,
As far as I know (from 8+ years ago), you need a child-theme to prevent settings being overwritten by an update. But apparently things have changed! Which is good news.
I’ve just changed the theme back to the regular GP theme, but then my site crashes again.
So, thank you for your offer to take a look! I’ll put the log-in details below.
Thank you!
YolandaApril 18, 2022 at 9:40 am #2192577Ying
StaffCustomer SupportHi Yolanda,
Your GP parent theme is out of date, can you try update it to the latest version?
-
AuthorPosts
- You must be logged in to reply to this topic.