Fatal error: Wordpress theme didn´t work after customising
Fatal error: Wordpress theme didn´t work after customising
我买了一个主题,把所有类从ivan改成了stge。这是客户的定制愿望。
我更改了洞主题,但总是出错。
http://www.strategen-gestalter.de/stge/
Fatal error: Class 'Ivan_Layout_Footer_Normal' not found in /var/www/web591/html/stge/inhalt_sg/themes/sg/framework/stge-framework.php on line 244
stge-framework.php 看起来像这样:
<?php
/**
* stge Framework Init Files
*
* This will start the default configuration used by stge.
*
* (Table of Contents)
* * - Contants - declare contants used by our theme.
* * - Helpers/Options - include general framework functions and theme options.
* * - Plugin Extensions
* * - Base Classes - classes made to be extended
* * - Modules
* * - Main Layouts
* * - Layouts
* * - Filters and Actions
* * - Main Render
*
*/
/**
* Define contants used by theme/framework
*/
define( 'stge_THEME_NAME', '_s' );
define( 'stge_FW_VERSION', '1.0.0' );
define( 'stge_FW_THEME_OPTS', 'iv_aries' );
define( 'stge_FW', get_template_directory() . '/framework' );
define( 'stge_OPTS', get_template_directory() . '/framework/options' );
define( 'stge_OPTS_ASSETS', get_template_directory() . '/framework/options/sections/assets' );
/**
* Include helpers used by our theme/framework
*/
// Metabox Options
require_once stge_FW . '/metaboxes/config.php';
// Redux Framework Core
/*
if ( !class_exists( 'ReduxFramework' ) && file_exists( stge_FW . '/options/ReduxFramework/ReduxCore/framework.php' ) ) {
require_once stge_FW . '/options/ReduxFramework/ReduxCore/framework.php';
}
*/
// ThemeConfigs
require_once get_template_directory() . '/theme-configs/theme-configs.php';
// stge Theme Options
if ( file_exists( stge_FW . '/options/theme_options.php' ) ) {
require_once stge_FW . '/options/theme_options.php';
}
// Helper: options related functions.
require_once stge_FW . '/helpers/options.php';
// Helper: post formats functions.
require_once stge_FW . '/helpers/post-formats.php';
// Helper: blog navigation, post pagination and custom comments markup.
require_once stge_FW . '/helpers/template-tags.php';
// Helper: custom title, nav fallback and few configurations.
require stge_FW . '/helpers/extras.php';
// Helper: title wrapper
require stge_FW . '/helpers/title.php';
/**
* Plugin Extensions
*/
// WooCommerce configuration and extension
if( class_exists('WooCommerce') )
require get_template_directory() . '/woocommerce/configuration.php';
if(function_exists('vc_set_as_theme'))
vc_set_as_theme();
// Login with AJAX configuration
require_once stge_FW . '/helpers/plugin_login_with_ajax.php';
// Ninja Forms configuration
require_once stge_FW . '/helpers/plugin_ninja_forms.php';
/**
* Base classes, Modules, Main Layouts, Layouts
*/
// Base Classes
require_once stge_FW . '/base-classes/class-main-layout.php';
require_once stge_FW . '/base-classes/class-module.php';
require_once stge_FW . '/base-classes/class-layout.php';
// Modules
require_once stge_FW . '/modules/class-logo.php';
require_once stge_FW . '/modules/class-menu.php';
require_once stge_FW . '/modules/class-live-search.php';
require_once stge_FW . '/modules/class-social-icons.php';
require_once stge_FW . '/modules/class-custom-text.php';
require_once stge_FW . '/modules/class-woo-cart.php';
require_once stge_FW . '/modules/class-login-ajax.php';
require_once stge_FW . '/modules/class-responsive-menu.php';
require_once stge_FW . '/modules/class-responsive-menu-select.php';
require_once stge_FW . '/modules/class-ads.php';
require_once stge_FW . '/modules/class-wpml-lang.php';
require_once stge_FW . '/modules/class-wpml-currency.php';
// Main Layouts
require_once ( stge_FW . '/main-layouts/class-normal.php' );
require_once ( stge_FW . '/main-layouts/class-aside-left.php' );
require_once ( stge_FW . '/main-layouts/class-aside-right.php' );
// Layouts
// Top Header
require_once stge_FW . '/layouts/top_header/class-two-columns.php';
// Header
require_once stge_FW . '/layouts/header/class-simple-right-menu.php';
require_once stge_FW . '/layouts/header/class-simple-logo-centered.php';
require_once stge_FW . '/layouts/header/class-classic-logo-centered.php';
require_once stge_FW . '/layouts/header/class-classic-right-area.php';
require_once stge_FW . '/layouts/header/class-only-menu.php';
// Title Wrapper
require_once stge_FW . '/layouts/title_wrapper/class-layout-title-wrapper-normal.php';
require_once stge_FW . '/layouts/title_wrapper/class-layout-title-wrapper-large.php';
// Content
require_once stge_FW . '/layouts/content/class-layout-content-normal.php';
// Footer
require_once stge_FW . '/layouts/footer/class-layout-footer-normal.php';
// Bottom Footer
require_once stge_FW . '/layouts/bottom_footer/class-layout-bottom-footer-two-columns.php';
/**
* Framework actions and filters
*/
// General actions and filters used by framework (custom CSS, custom JS, author profile and others)
require_once stge_FW . '/helpers/actions_filters.php';
if( false == function_exists('getPostLikeLink') )
require_once stge_FW . '/helpers/like_post.php';
require_once stge_FW . '/helpers/blog_actions_filters.php';
// Nice fallback when not using MegaMain Menu Plugin
if( false == class_exists('mmpm_primary_class') ) {
require_once stge_FW . '/helpers/menu_fallback.php';
}
// Render the layouts selected by user
add_action( 'wp', 'stge_main_render', 100);
function stge_main_render() {
/*****
* Main Layouts
****/
$layout = stge_get_option('main-layout');
// Set default in case of not loaded options
if( $layout == null OR $layout == '' )
$layout = 'stge_Main_Layout_Normal';
$main_layout = new $layout();
stge_set_current_caller('main-layout', $layout);
/*****
* Top Header Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('top-header-enable-switch')
AND 'stge_Main_Layout_Aside_Right' != stge_get_option('main-layout')
AND 'stge_Main_Layout_Aside_Left' != stge_get_option('main-layout') ) :
//Get selected layout from theme options
$top_header = stge_get_option('top-header-layout');
// Set default in case of not loaded options
if( $top_header == null OR $top_header == '' )
$top_header = 'stge_Layout_Top_Header_Two_Columns';
// Call class that will display the layout
$topHeaderLayout = new $top_header();
// Define current caller
stge_set_current_caller('layout', 'top-header');
endif; // ends disable check
/*****
* Header Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('header-enable-switch') ) :
//Get selected layout from theme options
$header = stge_get_option('header-layout');
// Set default in case of not loaded options
if( $header == null OR $header == '' )
$header = 'stge_Layout_Header_Simple_Right_Menu';
// Call class that will display the layout
$headerLayout = new $header();
// Define current caller
stge_set_current_caller('layout', 'header');
endif; // ends disable check
/*****
* Title Wrapper Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('title-wrapper-enable-switch') ) :
//Get selected layout from theme options
$title_wrapper = stge_get_option('title-wrapper-layout');
// Set default in case of not loaded options
if( $title_wrapper == null OR $title_wrapper == '' )
$title_wrapper = 'stge_Layout_Title_Wrapper_Normal';
// Call class that will display the layout
$titleWrapperLayout = new $title_wrapper();
// Define current caller
stge_set_current_caller('layout', 'title-wrapper');
endif; // ends disable check
// Content
$content_wrapper = 'stge_Layout_Content_Normal';
$contentWrapperLayout = new $content_wrapper();
/*****
* Footer Layout
****/
// Footer is always called, check is made directly in template file.
//Get selected layout from theme options
$footer = stge_get_option('footer-layout');
// Set default in case of not loaded options
if( $footer == null OR $footer == '' )
$footer = 'stge_Layout_Footer_Normal';
// Call class that will display the layout
$footerLayout = new $footer();
// Define current caller
stge_set_current_caller('layout', 'footer');
/*****
* Bottom Footer Layout
****/
// Footer is always called, check is made directly in template file.
//Get selected layout from theme options
$bottom_footer = stge_get_option('bottom-footer-layout');
// Set default in case of not loaded options
if( $bottom_footer == null OR $bottom_footer == '' )
$bottom_footer = 'stge_Layout_Bottom_Footer_Two_Columns';
// Call class that will display the layout
$bottomFooterLayout = new $bottom_footer();
// Define current caller
stge_set_current_caller('layout', 'bottom-footer');
// Render Layout
if( false == is_admin() ) {
$main_layout->render();
}
}
知道为什么这不起作用吗?
该错误不言自明,您正在尝试创建一个不存在的 class 实例。在第 244 行,您有以下内容:
$footerLayout = new $footer();
在此之前:
//Get selected layout from theme options
$footer = stge_get_option('footer-layout');
// Set default in case of not loaded options
if( $footer == null OR $footer == '' )
$footer = 'stge_Layout_Footer_Normal';
它的作用是将 $footer
变量设置为 stge_Layout_Footer_Normal
,但前提是 stge_get_option('footer-layout')
为空。此选项的当前值很可能是 Ivan_Layout_Footer_Normal
.
更改父主题的代码不是一个好习惯,但既然您已经这样做了,您可以:
- 通过转至
wp-admin/options.php
手动将 footer-layout
选项更改为 stge_Layout_Footer_Normal
- 或更改以下代码:
$footer = stge_get_option('footer-layout');
至
$footer = 'stge_Layout_Footer_Normal';
我买了一个主题,把所有类从ivan改成了stge。这是客户的定制愿望。
我更改了洞主题,但总是出错。
http://www.strategen-gestalter.de/stge/
Fatal error: Class 'Ivan_Layout_Footer_Normal' not found in /var/www/web591/html/stge/inhalt_sg/themes/sg/framework/stge-framework.php on line 244
stge-framework.php 看起来像这样:
<?php
/**
* stge Framework Init Files
*
* This will start the default configuration used by stge.
*
* (Table of Contents)
* * - Contants - declare contants used by our theme.
* * - Helpers/Options - include general framework functions and theme options.
* * - Plugin Extensions
* * - Base Classes - classes made to be extended
* * - Modules
* * - Main Layouts
* * - Layouts
* * - Filters and Actions
* * - Main Render
*
*/
/**
* Define contants used by theme/framework
*/
define( 'stge_THEME_NAME', '_s' );
define( 'stge_FW_VERSION', '1.0.0' );
define( 'stge_FW_THEME_OPTS', 'iv_aries' );
define( 'stge_FW', get_template_directory() . '/framework' );
define( 'stge_OPTS', get_template_directory() . '/framework/options' );
define( 'stge_OPTS_ASSETS', get_template_directory() . '/framework/options/sections/assets' );
/**
* Include helpers used by our theme/framework
*/
// Metabox Options
require_once stge_FW . '/metaboxes/config.php';
// Redux Framework Core
/*
if ( !class_exists( 'ReduxFramework' ) && file_exists( stge_FW . '/options/ReduxFramework/ReduxCore/framework.php' ) ) {
require_once stge_FW . '/options/ReduxFramework/ReduxCore/framework.php';
}
*/
// ThemeConfigs
require_once get_template_directory() . '/theme-configs/theme-configs.php';
// stge Theme Options
if ( file_exists( stge_FW . '/options/theme_options.php' ) ) {
require_once stge_FW . '/options/theme_options.php';
}
// Helper: options related functions.
require_once stge_FW . '/helpers/options.php';
// Helper: post formats functions.
require_once stge_FW . '/helpers/post-formats.php';
// Helper: blog navigation, post pagination and custom comments markup.
require_once stge_FW . '/helpers/template-tags.php';
// Helper: custom title, nav fallback and few configurations.
require stge_FW . '/helpers/extras.php';
// Helper: title wrapper
require stge_FW . '/helpers/title.php';
/**
* Plugin Extensions
*/
// WooCommerce configuration and extension
if( class_exists('WooCommerce') )
require get_template_directory() . '/woocommerce/configuration.php';
if(function_exists('vc_set_as_theme'))
vc_set_as_theme();
// Login with AJAX configuration
require_once stge_FW . '/helpers/plugin_login_with_ajax.php';
// Ninja Forms configuration
require_once stge_FW . '/helpers/plugin_ninja_forms.php';
/**
* Base classes, Modules, Main Layouts, Layouts
*/
// Base Classes
require_once stge_FW . '/base-classes/class-main-layout.php';
require_once stge_FW . '/base-classes/class-module.php';
require_once stge_FW . '/base-classes/class-layout.php';
// Modules
require_once stge_FW . '/modules/class-logo.php';
require_once stge_FW . '/modules/class-menu.php';
require_once stge_FW . '/modules/class-live-search.php';
require_once stge_FW . '/modules/class-social-icons.php';
require_once stge_FW . '/modules/class-custom-text.php';
require_once stge_FW . '/modules/class-woo-cart.php';
require_once stge_FW . '/modules/class-login-ajax.php';
require_once stge_FW . '/modules/class-responsive-menu.php';
require_once stge_FW . '/modules/class-responsive-menu-select.php';
require_once stge_FW . '/modules/class-ads.php';
require_once stge_FW . '/modules/class-wpml-lang.php';
require_once stge_FW . '/modules/class-wpml-currency.php';
// Main Layouts
require_once ( stge_FW . '/main-layouts/class-normal.php' );
require_once ( stge_FW . '/main-layouts/class-aside-left.php' );
require_once ( stge_FW . '/main-layouts/class-aside-right.php' );
// Layouts
// Top Header
require_once stge_FW . '/layouts/top_header/class-two-columns.php';
// Header
require_once stge_FW . '/layouts/header/class-simple-right-menu.php';
require_once stge_FW . '/layouts/header/class-simple-logo-centered.php';
require_once stge_FW . '/layouts/header/class-classic-logo-centered.php';
require_once stge_FW . '/layouts/header/class-classic-right-area.php';
require_once stge_FW . '/layouts/header/class-only-menu.php';
// Title Wrapper
require_once stge_FW . '/layouts/title_wrapper/class-layout-title-wrapper-normal.php';
require_once stge_FW . '/layouts/title_wrapper/class-layout-title-wrapper-large.php';
// Content
require_once stge_FW . '/layouts/content/class-layout-content-normal.php';
// Footer
require_once stge_FW . '/layouts/footer/class-layout-footer-normal.php';
// Bottom Footer
require_once stge_FW . '/layouts/bottom_footer/class-layout-bottom-footer-two-columns.php';
/**
* Framework actions and filters
*/
// General actions and filters used by framework (custom CSS, custom JS, author profile and others)
require_once stge_FW . '/helpers/actions_filters.php';
if( false == function_exists('getPostLikeLink') )
require_once stge_FW . '/helpers/like_post.php';
require_once stge_FW . '/helpers/blog_actions_filters.php';
// Nice fallback when not using MegaMain Menu Plugin
if( false == class_exists('mmpm_primary_class') ) {
require_once stge_FW . '/helpers/menu_fallback.php';
}
// Render the layouts selected by user
add_action( 'wp', 'stge_main_render', 100);
function stge_main_render() {
/*****
* Main Layouts
****/
$layout = stge_get_option('main-layout');
// Set default in case of not loaded options
if( $layout == null OR $layout == '' )
$layout = 'stge_Main_Layout_Normal';
$main_layout = new $layout();
stge_set_current_caller('main-layout', $layout);
/*****
* Top Header Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('top-header-enable-switch')
AND 'stge_Main_Layout_Aside_Right' != stge_get_option('main-layout')
AND 'stge_Main_Layout_Aside_Left' != stge_get_option('main-layout') ) :
//Get selected layout from theme options
$top_header = stge_get_option('top-header-layout');
// Set default in case of not loaded options
if( $top_header == null OR $top_header == '' )
$top_header = 'stge_Layout_Top_Header_Two_Columns';
// Call class that will display the layout
$topHeaderLayout = new $top_header();
// Define current caller
stge_set_current_caller('layout', 'top-header');
endif; // ends disable check
/*****
* Header Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('header-enable-switch') ) :
//Get selected layout from theme options
$header = stge_get_option('header-layout');
// Set default in case of not loaded options
if( $header == null OR $header == '' )
$header = 'stge_Layout_Header_Simple_Right_Menu';
// Call class that will display the layout
$headerLayout = new $header();
// Define current caller
stge_set_current_caller('layout', 'header');
endif; // ends disable check
/*****
* Title Wrapper Layout
****/
//Check if layout is not disabled
if( true != stge_get_option('title-wrapper-enable-switch') ) :
//Get selected layout from theme options
$title_wrapper = stge_get_option('title-wrapper-layout');
// Set default in case of not loaded options
if( $title_wrapper == null OR $title_wrapper == '' )
$title_wrapper = 'stge_Layout_Title_Wrapper_Normal';
// Call class that will display the layout
$titleWrapperLayout = new $title_wrapper();
// Define current caller
stge_set_current_caller('layout', 'title-wrapper');
endif; // ends disable check
// Content
$content_wrapper = 'stge_Layout_Content_Normal';
$contentWrapperLayout = new $content_wrapper();
/*****
* Footer Layout
****/
// Footer is always called, check is made directly in template file.
//Get selected layout from theme options
$footer = stge_get_option('footer-layout');
// Set default in case of not loaded options
if( $footer == null OR $footer == '' )
$footer = 'stge_Layout_Footer_Normal';
// Call class that will display the layout
$footerLayout = new $footer();
// Define current caller
stge_set_current_caller('layout', 'footer');
/*****
* Bottom Footer Layout
****/
// Footer is always called, check is made directly in template file.
//Get selected layout from theme options
$bottom_footer = stge_get_option('bottom-footer-layout');
// Set default in case of not loaded options
if( $bottom_footer == null OR $bottom_footer == '' )
$bottom_footer = 'stge_Layout_Bottom_Footer_Two_Columns';
// Call class that will display the layout
$bottomFooterLayout = new $bottom_footer();
// Define current caller
stge_set_current_caller('layout', 'bottom-footer');
// Render Layout
if( false == is_admin() ) {
$main_layout->render();
}
}
知道为什么这不起作用吗?
该错误不言自明,您正在尝试创建一个不存在的 class 实例。在第 244 行,您有以下内容:
$footerLayout = new $footer();
在此之前:
//Get selected layout from theme options
$footer = stge_get_option('footer-layout');
// Set default in case of not loaded options
if( $footer == null OR $footer == '' )
$footer = 'stge_Layout_Footer_Normal';
它的作用是将 $footer
变量设置为 stge_Layout_Footer_Normal
,但前提是 stge_get_option('footer-layout')
为空。此选项的当前值很可能是 Ivan_Layout_Footer_Normal
.
更改父主题的代码不是一个好习惯,但既然您已经这样做了,您可以:
- 通过转至
wp-admin/options.php
手动将 - 或更改以下代码:
footer-layout
选项更改为 stge_Layout_Footer_Normal
$footer = stge_get_option('footer-layout');
至
$footer = 'stge_Layout_Footer_Normal';