enqueue parent style beginner issues
-
Hello,
To start off, let me say that have gone through and read as many of the posts about ‘enqueue parent styles’ as I can and still have a lot of trouble grasping the process. For my inability to comprehend this, I am sorry.
So, I have made child themes before, which is also why I feel stupid, and yet even using just @import am unable to load the parent styles. I have checked the style sheet header and everything is in order there, or so I believe as I copied it from the codex, yet substituting my theme names.
EDIT: May I add that the styles were compiled in scss. Would that make a difference? Is it worth it to work with this or would it be better to pick a different theme to work from? There are 3 css files:
style-compiled.css commented as the original SASS build for the theme CSS
style.css
style.scss
This site is on my desktop so I am unable to post a link code will have to do.
/* Theme Name: Hellish Simplicity Child Theme URI: http://geek.ryanhellyer.net/themes/hellish-simplicity/ Description: Hellish Simplicity Child Theme Author: Lisa Reisman Author URI: http://lisareisman.com Template: hellish-simplicity /*note: this is theme folder name*/ 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, white, red, black, one-column, two-columns, right-sidebar, fluid-layout, custom-header, full-width-template, rtl-language-support, translation-ready, sticky-post, theme-options, threaded-comments Text Domain: hellish-child */Now here’s where I get lost. According to the Codex, to call the parent style you simply use ‘parent-style’. I do not see any instruction on whether or not to change that to the name of the parent theme or how to phrase it. Same for the child style. BUT, in forum examples, I see where the names are specified to the theme but there doesn’t seem to be any consistency in the phrasing, i.e. ‘hellish-simplicity-style’ vs ‘szy200-style’ when that is not the theme name.
So, I hope you understand my predicament. This is the enqueue function I am trying to use.
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style') ); }all wrapped up in a php tag.
Should ‘parent-style’ be written as ‘hellish-simplicity-style’ and child-style’ written as ‘hellish-simplicity-child-style’?
And shouldn’t the path to the style.css start in the template folder not the root?
I thank you very much for your time and your patience.
Lisa Rose
The topic ‘enqueue parent style beginner issues’ is closed to new replies.