2

So I have a css file :
CSS File

I also have enqueued it, : Functions.php When I activate the theme, and try to view my page, no css is on it, Foundation is working, normalize is working, but not my css file, when I inspect element it's empty, and I don't know what I have to do.. ( The global.css source file in Inspect Element is empty, Foundation & normalize is not. )

Not allowed to post a 3rd link, but don't really think I need to show you a google chrome inspect element thing anyways..

Would really appriciate any help!

2
  • Please, write code instead of images of code; it can not be copied if needed to test it or whatever.
    – cybmeta
    Feb 17 '17 at 10:46
  • 1
    @cybmeta Ye, I'll keep that in mind next time, thank you :D
    – Deeze
    Feb 17 '17 at 12:38
4

In a quick view, the arguments you use in wp_enqueue_style() are not correct for global.css. The third parameter is used to declare the dependencies and you have set that parameter to the string 'false' but it should be an array. If the CSS does not depend on another CSS, use an empty array.

In your case, I guess that the global.css depends on the other css you are lodaing (foundation, normalize, etc), so you should declare those dependencies.

You are using the fourth parameter incorrectly too. The fourth parameter is used to specified the version. 'all' seems not a version. If you don't want to declare a version, use null, but I think it is good to declare the version in all the CSS files you are loading. For example, if you use some browser cache and update the foundation CSS, the upade won't be sent to the users that have the CSS already cached in their browsers. If you declare the version, the URL will change after the update and the users will get the new CSS version.

There is also a missing / in the URL (noted by Pedro in his answer).

wp_enqueue_style( 'venix_css', get_template_directory_uri() . '/css/global.css', array( 'normalize_css', 'foundation_css', 'googlefont_css' ), '1.0' );

Also, since WordPress 4.7, it is better if you use get_theme_file_uri() instead of get_template_directory_uri(). The new function is more flexible and allows child themes to override parent theme files easily.

wp_enqueue_style( 'venix_css', get_theme_file_uri( 'css/global.css' ) , array( 'normalize_css', 'foundation_css', 'googlefont_css' ), '1.0' );
2
  • 1
    Also, foundation.css should be dependent on normalize.css.
    – Max Yudin
    Feb 17 '17 at 11:33
  • I'll start using get_theme_file_uri() instead of get_template_direcroty_uri() - / in the url actually fixed it, thank you -
    – Deeze
    Feb 17 '17 at 12:33
2

it looks like your forgot a slash before css/global.css. The others are fine.

Should read

get_template_directory_uri() . '/css/global.css'

Let me know if it works!

1
  • This actually fixed it, thank you for pointing that out ! :D
    – Deeze
    Feb 17 '17 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.