• kowabungawp

    (@kowabungawp)


    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!

Viewing 1 replies (of 1 total)
  • Shahin

    (@skalanter)

    Hello @kowabungawp,

    Thank you for reaching out,

    There are no issues with that function.

    However, you can change the name of “style.css” and re-test it to see if it loads.

    Also, you can remove that function and write your own code with any name you want.
    Please follow the steps explained in this article:
    https://developer.www.ads-software.com/themes/advanced-topics/child-themes/

    Please note: It may be affected by third-party plugins or system cache.

    I hope it helps.
    Best Regards

Viewing 1 replies (of 1 total)
  • The topic ‘Child Theme Version Bug’ is closed to new replies.