WordPress plugin include css from subdirectory

I have a question about including an css file (wordpress) for my metabox styling in the backend. I have read the ebook “Building WordPress Theme From Scratch” from Rockable. They had the following snippet of code that link to the css (in same folder):

<style type="text/css">
<?php include(dsslider-manager.css'); ?>
</style>

That’s works fine, but I want to organize my css in a subfolder like: assets/css/dsslider-manager.css

Read More

But there will no linking to the file. When I look with firebug there is an error, but when I past the url that’s given, it will link to the right place…

The error is:

Warning: include(): http:// wrapper is disabled in the server configuration by allow_url_include=0 in /customers/0/d/a/xxx.xx/httpd.www/wordpress/wp-content/plugins/ds-flexslider/includes/cpt-manager.php on line 66 

What do I wrong?

Thank you for helping..

Related posts

Leave a Reply

1 comment

  1. That error is due you are trying to include a remote file, which it is not recommend anyway.
    So download dsslider-manager.css to a local folder inside your plugin and include it like this:

    wp_enqueue_style('my_css_dsslider', PLUGIN_URL . '/assets/css/dsslider-manager.css');
    

    But that is not all that you need to successfully include assets files. Check following answer for a complete review of how to do it (css and js files) in the right way.

    Once you have learned you will can do the same in all your plugins.