Support » Theme: Twenty Nineteen » child theme

  • Hello,

    With child themes and in functions.php, when you add this wp_enqueue_style( ‘child-style’===> should child-style be the named of the folder of the child theme? i.e. should child-style be myfoo-style because the name of my child theme folder is called myfoo?

    function my_theme_enqueue_styles() {

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

    $parent_style = ‘twentynineteen-style’;
    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’ );

Viewing 3 replies - 1 through 3 (of 3 total)
  • TUT Support

    (@phpexpert21)

    Hello @miakurt1,

    You can create the child theme with the help of below listed article-

    https://www.wpbeginner.com/wp-themes/how-to-create-a-wordpress-child-theme-video/

    Kind regards,

    Manoj

    miakurt1

    (@miakurt1)

    My question is can child-style be the named of the folder of the child theme? i.e. can child-style be myfoo-style because the name of my child theme folder is called myfoo?

    $parent_style = ‘twentynineteen-style’;
    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’)

    The 1st parameter for wp_enqueue_style is the $handle or name of the style sheet.

    Yes, you can name this the same as the name of your child theme folder.

    wp_enqueue_style( 'myfoo-style', $src, $deps, $ver, $media );

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘child theme’ is closed to new replies.