Не устанавливается дочерняя тема без style.css
-
Создал дочернюю тему. В файле functions.php прописаны подгружаемые стили. Но WordPress ругается на отсутствие style.css. Но у меня его нет, ссылки на него я его не указывал.
Пробовал два варианта.
1.if ( !function_exists( 'chld_thm_cfg_locale_css' ) ): function chld_thm_cfg_locale_css( $uri ){ if ( empty( $uri ) && is_rtl() && file_exists( get_template_directory() . '/rtl.css' ) ) $uri = get_template_directory_uri() . '/rtl.css'; return $uri; } endif; add_filter( 'locale_stylesheet_uri', 'chld_thm_cfg_locale_css' ); if ( !function_exists( 'chld_thm_cfg_parent_css' ) ): function chld_thm_cfg_parent_css() { wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( ) ); } endif; add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 ); if ( !function_exists( 'child_theme_configurator_css' ) ): function child_theme_configurator_css() { wp_enqueue_style( 'chld_thm_cfg_separate', trailingslashit( get_stylesheet_directory_uri() ) . 'style-addon.css', array( 'chld_thm_cfg_parent','easywp-maincss','font-awesome' ) ); } endif; add_action( 'wp_enqueue_scripts', 'child_theme_configurator_css', 10 );
2.
add_action( 'wp_enqueue_scripts', 'jurvrn_on_easywp_enqueue_child_styles' ); function jurvrn_on_easywp_enqueue_child_styles() { $parent_style = 'parent-style'; wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css' ); wp_enqueue_style('child-style-addon', get_stylesheet_directory_uri() . '/style-addon.css', array( $parent_style ), wp_get_theme()->get('Version') ); wp_enqueue_style('child-style-mobile', get_stylesheet_directory_uri() . '/style-mobile.css', array( $parent_style, 'child-style-addon' ), wp_get_theme()->get('Version'), 'all (max-width:1167px)' ); }
Просмотр 8 ответов — с 1 по 8 (всего 8)
Просмотр 8 ответов — с 1 по 8 (всего 8)
- Тема «Не устанавливается дочерняя тема без style.css» закрыта для новых ответов.