0

At the moment I'm trying to create my own WordPress blog with an own theme. It works really good so far but I have one problem: I use the skel.js and this tryes to load a css file. which can't be found because it looks under:

/wp-admin/css/style.css

I'm really new to WordPress soI have no idea how I can tell the JS file that it has to look in the specific theme folder and there in the subfolder css?

0

2 Answers 2

2

The following code should go in your functions file. Then your css should go into your css folder in your theme

function enqueue_additional_stylesheets() {
    // Register the style like this for a theme:
    wp_register_style( 'css_file', get_template_directory_uri() . '/css/yourfile.css', array(), '20150505', 'all' );
    wp_enqueue_style( 'css_file' );         
}
add_action( 'wp_enqueue_scripts', 'enqueue_additional_stylesheets' );
Sign up to request clarification or add additional context in comments.

Comments

0

You can either modify the JS file (which may pose a problem when you do version updates), or you can put the CSS file where it's expected. The latter seems like a simple approach.

You could also use an @import statement in style.css (at the expected location) to include the other file (at its current location).

@import '../themes/theme/subfolder/file.css';

https://developer.mozilla.org/en-US/docs/Web/CSS/@import

2 Comments

As you said I do not want to really want to edit the js file. How can I put the file there? Only mannullay over a FTP? I thought that I can not put files there if I install the template over the Wordpress interface...
I don't recall whether WP offers the ability to add new files. You'll probably need to use FTP. It shouldn't matter how you installed the template.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.