php - What exactly have I to do to create a child theme of a theme having more css files? -
i have create child theme implement changes wordpress theme , avoid losing these changes when theme updated. have doubt how it.
i following official tutorial: https://codex.wordpress.org/child_themes
i have create child theme directory (named accesspress-parallax-child
because directory of original theme accesspress-parallax
) wordpress wp-content/themes/
directory of wordpress installation. have put style.css
, functions.php
files in new folder.
i have put commented code in style.css
file (as explained documentation):
/* theme name: accesspress parallax child theme uri: http://example.com/twenty-fifteen-child/ description: accesspress parallax child theme author: andrea nobili author uri: http://example.com template: accesspress-parallax version: 1.0.0 license: gnu general public license v2 or later license uri: http://www.gnu.org/licenses/gpl-2.0.html tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready text domain: accesspress-parallax-child */
now says have enqueue parent , child theme stylesheets putting code functions.php
file:
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); }
now have 2 doubts:
in previous code snippet, have refer parent theme in way or not? how know parent theme is?
in documentation says:
the following example function work if parent theme uses 1 main style.css hold of css. if theme has more 1 .css file (eg. ie.css, style.css, main.css) have make sure maintain of parent theme dependencies.
what mean? in original theme have more single .css file. in fact, in original theme have css directory contains many css files.
what have solve problem?
- it "knows" it's referring parent theme because
get_template_directory_uri()
returns uri parent theme. if want uri child theme, useget_stylesheet_directory_uri()
. - since parent theme includes multiple css files, may need enqueue each of them separately (if aren't automatically enqueued). varies theme. if styles broken, make sure re-enqueue need using
wp_enqueue_style()
, ,get_template_directory_uri()
.
Comments
Post a Comment