0

I've created a child theme but the parent theme seems to use bloginfo('stylesheet_directory') to point to a lot of CSS and js files, none of which are currently loading.

As I believe the 'stylesheet_directory' is meant to point to the main CSS file directory, my child theme, am I going to have to copy the header into my child theme and update the paths with a different shortcode?

Is there a better way?

New contributor
Ross Coulbeck is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
0

If the parent theme is properly coded, the following code in the child theme functions.php file should load the parent css.

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}
?>

As for the javascript, I think that if the parent theme loads theme with wp_enqueue_scripts they should work in the child theme.

  • Thanks. I've got that in my functions.php files but it looks like the parent theme wasn't properly built. A lot of the links for css and js use bloginfo('stylesheet_directory') which is pointing to the child theme. – Ross Coulbeck Jan 13 at 11:11

Your Answer

Ross Coulbeck is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.