Child Theme Version Bug
-
Hi, I found an issue in the official child theme code to enqueue the child style (the name of the function is also wrong):
function oceanwp_child_enqueue_parent_style() { // Dynamically get version number of the parent stylesheet (lets browsers re-cache your stylesheet when you update the theme). $theme = wp_get_theme( 'OceanWP' ); $version = $theme->get( 'Version' ); // Load the stylesheet. wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css', array( 'oceanwp-style' ), $version ); } add_action( 'wp_enqueue_scripts', 'oceanwp_child_enqueue_parent_style' );
https://github.com/oceanwp/oceanwp-child-theme/blob/master/functions.php
It is assigning the version from the parent theme to the child theme instead of the current version of the child theme (1.0.3). Current version is assigned to the parent theme, I believe they are mixed up.
<link rel='stylesheet' id='oceanwp-style-css' media='all' /> <link rel='stylesheet' id='child-style-css' media='all' />
If I add custom css to my child theme stylesheet the changes are not reflected on the site, even after cache refresh. That happens because it is reading style.css?ver=6.4.3 instead of style.css directly, or current version style.css?ver=1.0.3
Can you take a look, please? The only way to load the current css is to set the version hard coded, but it is not practical.
Thanks!
- The topic ‘Child Theme Version Bug’ is closed to new replies.