0
votes

I just make a html site with bootstrap 3. Now I am trying to make it wordpress theme. I make the index.html to index.php & I make a css file called "style.css"

In style.css I import my bootstrap css file like this way:

@import url('css/bootstrap.css');
@import url('css/bootstrap.min.css');

Then I upload the theme on a server. I active the theme. But my site looks like without any css. It seems a html site without any css. I tried in many way but don't understand why my theme don't find css. I don't make any change in my theme like using php function in my theme yet.

Please if you guy know the solution of this problem please help me.

3

3 Answers

1
votes

Use WP enqueue_scripts function for including bootstrap css/js in functions.php

function add_style() {

wp_register_style('bootstrap-css',get_template_directory_uri()."/css/bootstrap.css");
wp_register_style('bootstrap-min-css',get_template_directory_uri()."/css/bootstrap.min.css");

wp_enqueue_style( 'bootstrap-css' );
wp_enqueue_style( 'bootstrap-min-css' );
}

add_action('wp_enqueue_scripts', 'add_style');
0
votes

You need to link the style.css to the HTML with <link rel="stylesheet" type="text/css" href="/pathtothecss/theme.css">

And I suggest you don't use the @import. Just link all of the css stylesheets to the <head> section of your site.

0
votes

@import url('/css/bootstrap.min.css');