Child style version into functions.php not available

This topic has 4 replies, 2 voices, and was last updated 1 months, 1 weeks ago ago by Luca Rossi

  • Avatar: Gbp
    June 14, 2024 at 16:52

    in child theme functions.php
    “add_action( ‘wp_enqueue_scripts’, ‘theme_enqueue_styles’, 1001 );
    function theme_enqueue_styles() {

    so I cannot define version of css.

    usually I use :
    define(“CHILD_THEME_VERSION”, “1.0.2”);
    function child_enqueue_styles()
    wp_enqueue_style(“benjaminb-theme-css”, get_stylesheet_directory_uri() . “/style.css”, [“parent-theme-css”], CHILD_THEME_VERSION, “all”);
    add_action(“wp_enqueue_scripts”, “child_enqueue_styles”, 15);

    Is there any way we can pass this CHILD_THEME_VERSION into etheme_child_styles();
    etheme_child_styles(); does not allow var to be passed ?

    thank you

    3 Answers
    Avatar: Justin
    Luca Rossi
    Support staff
    June 14, 2024 at 17:12

    Hi @Gbp,

    Please add the following code to functions.php file locates in your child theme:

    	function etheme_child_styles() {
    		// files:
    		// parent-theme/style.css, parent-theme/bootstrap.css (parent-theme/xstore.css), secondary-menu.css, options-style.min.css, child-theme/style.css
    		$theme = wp_get_theme();
    		wp_enqueue_style( 'child-style',
    			get_stylesheet_directory_uri() . '/style.css',
    //			array('parent-style', 'bootstrap'),
    			array( 'etheme-parent-style' ),

    Hope it helps!

    Avatar: Gbp
    June 17, 2024 at 11:12

    Thank you
    I’ll test

    Avatar: Justin
    Luca Rossi
    Support staff
    June 17, 2024 at 11:14

    Let us know how it goes!

    Best Regards,
    The 8Theme Team.

  • Viewing 4 results - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.Log in/Sign up

We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.