style.css not working in wordpress

I have a problem with WordPress, I’ve created all needed files including style.css index.php and so on but the page is not styled. In header, among other things, I’ve put this

<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/css/bootstrap-responsive.css" />
<link rel="stylesheet" type="text/css" href="text/css" href="<?php bloginfo('template_url'); ?>/css/style.css" />

Related posts

Leave a Reply

8 comments

  1. Add stylesheet other than style.css, open function.php and add the following code.

    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
    function theme_name_scripts() {
       wp_enqueue_style( 'style-name', get_stylesheet_uri() . "/css/bootstrap.css" );
       wp_enqueue_style( 'style-name', get_stylesheet_uri() . "/css/bootstrap-responsive.css" );
    }
    

    Add the style.css file using thins:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
    
  2. Add the following to your functions.php, it should work.

    function EnqueueMyStyles() {
        wp_enqueue_style('my-custom-style', get_template_directory_uri() . '/css/my-custom-style.css', false, '20150320');
    
        wp_enqueue_style('my-google-fonts', '//fonts.googleapis.com/css?family=PT+Serif+Caption:400,400italic', false, '20150320');
    
        wp_enqueue_style('my-main-style', get_stylesheet_uri(), false, '20150320');
        }
    }
    add_action('wp_enqueue_scripts', 'EnqueueMyStyles');
    
  3. Open function.php file and past the following code.

    add_action( 'wp_enqueue_scripts', 'theme_name_scripts' );
        function theme_name_scripts() {
           wp_enqueue_style( 'style-name1', get_stylesheet_uri() . "/css/style.css" );
           wp_enqueue_style( 'style-name2', get_stylesheet_uri() . "/css/bootstrap.css" );
    }
    
  4. For my case, i had not linked CSS. So i solved it by doing the following:

    1. I created a file header.php this file had my html code and inside of this file, instead of manually including the css file using link , i called a php function wp_head(); which helps wordpress to take control of my head section.
        <!DOCTYPE html>
        <html>
          <head>
            <?php wp_head(); ?>
          </head>
          <body>
            <h1>Wordpress</h1>
          </body>
        </html>

    After that i had to create another new file in the themes folder called functions.php and linked style.css in this file using the following code.

    <?php
    function files() {
      wp_enqueue_style( 'style', get_stylesheet_uri() );
    } 
      add_action( 'wp_enqueue_scripts', 'files' );
    
    ?>
  5. I had the same problem, but I fixed it by looking carefully in my code. This is what I wrote before:

    <link href="<?php bloginfo('stylesheet_url'); ?> rel="stylesheet" type="text/css" media="all" /> 
    

    As well as the following code helped me solved the problem:

    <link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>">
    

    Can you see the difference? Comment below if you have any questions.

  6. when you also have 2 site URLs or home URLs in your plugins or CSS when you look it up in the inspection on chrome or some browser. And opening this in a new tab (btw this should not be accessible)::

    then try to put

    “/” without the “” in your localhost or whatever > phpmyadmin > database (of WordPress) > wp_options >> “siteurl” and “home” in option_value

  7. Replace template_url with template_directory in bloginfo and all done like:

    <link ... href="<?php bloginfo('template_directory'); ?>/css/bootstrap.css" />
    <link ... href="<?php bloginfo('template_directory'); ?>/style.css" />
    
  8. In functions.php add this code it will link style.css file to your WordPress theme

    function load_scripts() {
        wp_enqueue_style( 'stylecss', get_stylesheet_uri() );  
    }
    
    add_action('wp_enqueue_scripts', 'load_scripts' );