• Greetings!

    I have a question regarding the creation of a child theme from an unmodified parent. In the Codex, there is a ‘How-To’ (https://codex.www.ads-software.com/Child_Themes) which I am following. In the how-to, the following statement is made regarding the creation of the functions.php file for the child theme:

    If your child theme style.css contains actual CSS code (as it normally does), you will need to enqueue it as well. Setting ‘parent-style’ as a dependency will ensure that the child theme stylesheet loads after it. Including the child theme version number ensures that you can bust cache also for the child theme.

    And the following example is shown:

    <?php
    function my_theme_enqueue_styles() {

    $parent_style = ‘parent-style’; // This is ‘twentyfifteen-style’ for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . ‘/style.css’ );
    wp_enqueue_style( ‘child-style’,
    get_stylesheet_directory_uri() . ‘/style.css’,
    array( $parent_style ),
    wp_get_theme()->get(‘Version’)
    );
    }
    add_action( ‘wp_enqueue_scripts’, ‘my_theme_enqueue_styles’ );
    ?>

      My question is:

    Where exactly in the example shown does the ‘child theme version number’ go and won’t the child theme version number be identical to the parent’s version number?

    Thanks in advance for your support!

    Frank

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Creating function.php file for child theme’ is closed to new replies.