1

Following this solution to create dynamic css instead of inline css from sorich87 I get an error when requesting the dynamically generated stylesheet. Css is in there but also the default wp error page and a 404 header returned.

Solution I used: https://wordpress.stackexchange.com/a/1454

My stylesheet url with 404 error: http://tegelzetbedrijf.net/wp-content/plugins/wp-google-fonts/googlefonts.css?build=20120126

Any suggestions are highly appreciated! Thanks Quokka

4
  • I'm not sure I understand what the error is...it looks like you're outputing text though, not CSS.
    – mor7ifer
    Commented Feb 19, 2012 at 15:40
  • Hi, I'm outputting css, with header("Content-type: text/css"); But a 404 error is triggered, I understand why, because the file is not physically available. But if anyone knows how to prevent this, that would be awesome! Thanks!
    – quokka
    Commented Feb 19, 2012 at 15:47
  • View source, you have a lot of HTML in there, CSS files need to be pure CSS. It looks like wordpress is trying to load it as a template or something of that nature.
    – mor7ifer
    Commented Feb 19, 2012 at 15:58
  • Yes I know that, wp is serving the defaul 404 page. With my css in it. I would like to know how to prevent that and avoid the 404 error from happening. Thanks
    – quokka
    Commented Feb 19, 2012 at 17:23

1 Answer 1

0

The solution you're using to get the stylesheets onto the page is a terrible method. Wordpress provides the enqueue functions specifically to do what you're trying to do. The codex page on wp_enqueue_style() explains exactly what you need to do. If you would like to add a dynamic version, there is a parameter for that.

1
  • Thanks a lot, i'll digg into that!! For the meantime if just added the css in my stylesheet manually :)
    – quokka
    Commented Feb 19, 2012 at 22:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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