I've created a site over the last few months, and now I should upload it to a WordPress server.
On my own server, without WordPress, just PHP and ApacheWordPress2, everything works just fine. PHP includes include the CSS content as asked from root as a style.css.
I have all my CSS loaded in <?php include 'include/head.php';?>
.
Part of the head.php file:
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/normalize.min.css"/>
<link rel="stylesheet" type="text/css" href="js/vendor/slick/slick.css"/>
1
But when I upload the site into project/wp-content/themes/project
. suddenly any of the resources won't load.
Everything from JavaScript scripts in /js folders, images in /img and extra CSS in the /css folder or even the style.css in root won't load. It's all just 404 on the inspectors network tab.
I've included the header part in style.css as requested by WordPress, but should I do something more?
The Inspector tab seems to indicate that it's trying to load from correct path, but it still gives 404.
My folder structure is following:
Inside wp-content/themes/project
pages.php(20 of them, also index.php)
style.css - basic css for site layout
css/ *more css files*
img/ *image files*
include/ *PHP includes*
js/ *js action for site*
Octal for theme/project permission is: 2755
I hope this post makes any sense.
You should enqueue your style like this in your function.php:
<?php add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));}
public function enqueue_styles() {
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css'); false);
}?>
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments