0

In another WP site where I don't use bootstrap, in the functions.php file, I call the css file this way:

//css
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/mycss.css');

This functions correctly and the necessary pieces are picked up. When I use the latest version of bootstrap 3.3.7, and call it the same way, it fails to pick up the css file:

//css
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css');

I have checked on a test HTML file and the only CSS file that it references is the above file in the folder (though I uploaded the other boostrap files in case it points to them from the bootstrap.min.css file).

So the functions.php approach did not yield the design that I wanted.

Next, I tried this technique.

  1. Change the header.php css reference to the code he mentions in the second box after Find the links to the CSS files in the header and change them from this (I can't post it here because it generates an error - doesn't show the code and not sure why).

  2. Updated the style.css file with references to all of bootstraps .css files, such as bootstrap.css, bootstrap.min.css, etc.

  3. I updated the header.php and footer.php functions involving wp_ as discussed.

Nothing; still HTML skeleton. What is wrong here? Thanks!

Code Details:

header.php

<!DOCTYPE html>
<html lang="en" >
<head>
    <meta charset="utf-8" />
    <meta name="author" content="Script Tutorials" />
    <title>Test</title>
    <!-- CSS -->
    <link href="<?php bloginfo('stylesheet_url');?>" rel="stylesheet">
    <?php wp_head(); ?>
</head>
<body>

functions.php

    <?php

    function bootstrap_script_enqueue() {
        //css
        wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css');

    }

    add_action( 'wp_enqueue_scripts', 'bootstrap_script_enqueue');

?>
1
  • If exact same code fails with different file then the issue is likely with the file. Does it appear in page source? Does it load if you follow link directly?
    – Rarst
    Dec 7, 2016 at 18:28

1 Answer 1

0

Don't know what happened and I don't see an answer.

Basically, I had to use another them and one-by-one, change all the files, then download it and make it my own. It references bootstrap in the functions.php the same way that I do, yet it works and my theme didn't. Every file has been completely scrubbed and replaced with my code, so I am at a loss why that worked, since none of the theme's original code remained.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.