php - How to load up a CSS file in a Wordpress child theme that's nested in a different folder and name? -
this easy want make sure i'm doing correctly. i've been making bunch of wordpress sites using child themes , style.css in root folder of theme , i've been using in functions.php file
<?php add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); }
while file exists in parent theme i'm using, it's blank , realized css file being used different file name , nested in
\theme-name\framework\css\site\stacks\theme-css.css
opposed theme-name\style.css
so child theme have recreate folder structure , place same named theme-css.css in same folder or call style.css , put in child themes root folder be? other advice helpful. thanks.
to add stylesheet when in child theme, these 2 options/behaviors:
// point style.css in child theme wp_enqueue_style( 'my_child_styles', get_stylesheet_directory_uri().'/style.css' ); // point style.css in parent theme wp_enqueue_style( 'my_parent_styles', get_template_directory_uri().'/style.css' );
as said, when using get_template_directory_uri() path point parent theme folder. use get_stylesheet_directory_uri() point current / child theme folder, if applicable.
Comments
Post a Comment