Home>

I want to read multiple css with wordpress, so I wrote the following in functions.php
I get an error for some reason.
I tried it with the following code.
Sample written in the comment
The file looks like the picture below

<!-Functions.php->
<? php
function sample_scripts () {
  // The sample part is the theme-specific prefix name. Use a function name that does not overlap with other files
  wp_enqueue_style ('sample-style', get_stylesheet_uri ());
}
wp_enqueue_style ('sample-style', get_template_directory_uri ().'/css/responsive.css');
add_action ('wp_enqueue_scripts','sample_scripts');


  • Answer # 1

    Fixed a description error that changed the argument name of functions.php.
    In the end, it looks like this

    <? php
    add_action ('wp_enqueue_scripts','theme_enqueue_styles');
    function theme_enqueue_styles () {
        wp_enqueue_style ('parent-style', get_template_directory_uri ().'/style.css');
        wp_enqueue_style ('responsive', get_stylesheet_directory_uri ().'/responsive.css');// hoge.css in the child theme folder
    }

  • Answer # 2

    Isn't it because the directory sydney-child has "--copy" in it?

  • Answer # 3

    For the time being, the first argument of wp_enqueue_style is covered
    If it is duplicated, it will be overwritten

    get_stylesheet_uri isChild themeURL of css file
    get_template_directory_uriParent themeURL

    If there is an error, please describe the content of the error

  • Answer # 4

    Fixed a description error that changed the argument name of functions.php.
    In the end, it looks like this

    <? php
    add_action ('wp_enqueue_scripts','theme_enqueue_styles');
    function theme_enqueue_styles () {
        wp_enqueue_style ('parent-style', get_template_directory_uri ().'/style.css');
        wp_enqueue_style ('responsive', get_stylesheet_directory_uri ().'/responsive.css');// hoge.css in the child theme folder
    }