child stylesheet loading twice
-
I followed the instructions for creating a child theme, and added the following to my child functions.php:
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' ); function my_theme_enqueue_styles() { $parenthandle = 'parent-style'; // This is 'twentytwenty-style' for the Twenty Twenty theme. $theme = wp_get_theme(); wp_enqueue_style( $parenthandle, get_template_directory_uri() . '/style.css', array(), // if the parent theme code has a dependency, copy it to here $theme->parent()->get('Version') ); wp_enqueue_style( 'child-style', get_stylesheet_uri(), array( $parenthandle ), $theme->get('Version') // this only works if you have Version in the style header ); }
But now my child stylesheet is loading twice:
<link rel='stylesheet' id='parent-style-css' href='https://www.MyWebsite.com/wp-content/themes/twentytwenty/style.css?ver=1.6' media='all' /> <link rel='stylesheet' id='child-style-css' href='https://www.MyWebsite.com/wp-content/themes/twentytwenty-child/style.css?ver=1.5' media='all' /> <link rel='stylesheet' id='twentytwenty-style-css' href='https://www.MyWebsite.com/wp-content/themes/twentytwenty-child/style.css?ver=1.5' media='all' />
Where did I go wrong?
Thanks!
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘child stylesheet loading twice’ is closed to new replies.