WordPress-Underscores-CSS unable to load CSS file correctly

I try to make a Website with Wordpress and use the Underscores - Theme. I made a custom CSS file under /css/custom-css.css to style the most part of the website. If i load the CSS by the funciton.php noting happen. If i inspect the website on Firefox under the Style-Editor-tab i fine my css with a long and strange HTML code. The third line is my function.php code, which i added to the existing UnderscoreS - Code to load the styles and scripts: function hirsch_scripts() { wp_enqueue_style( 'hirsch-style', get_stylesheet_uri(), array(), _S_VERSION ); wp_enqueue_style( 'custom-css-style', get_stylesheet_uri() . '/css/custom-css.css', array(), null, 'all'); wp_style_add_data( 'hirsch-style', 'rtl', 'replace' ); wp_enqueue_script( 'hirsch-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'hirsch_scripts' ); The test code in my custom.css: #home-title { background-color: blue !important; color: red; } A screenshot and the beginning of the HTML code that appears in the style-editor tab from the inspector (very long): enter image description here <!doctype html> <html lang="de-CH"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="profile" href="https://gmpg.org/xfn/11"> <LINK href="./css/custom-css.css" rel="stylesheet" type="text/css"> I try to load it on several different ways. I'm not sure if the CSS doesn't get loaded at all or if the UnderscoreS - Theme tries to convert it in to a HTML (which would be indicated by the inspector). But i'm not used to the style-editor tab, so maybe i missinterpretate that. Thanks a lot for any help. Update: I think i figured it out. "get_stylesheet_uri()" seems to direct up to .../style.css. i have to use "get_template_directory_uri()".

Comment (1)

Jese Leos

23 hours ago

Verified user

I figured it out. Actually "get_stylesheet_uri()" loads ./style.css, so the path directs to the file. I would need to go to a higher hierarchy or simply use "get_template_directory_uri()". As far as i understood, it could be a problem if someone would make a child-theme but for me it workes fine :).

You’ll be in good company