amnmustafa15
amnmustafa15

Reputation: 111

No idea where this stylesheet is coming from - wordpress php

I'm trying to update my website but one thing I'm noticing is that I can't get rid of the original stylesheet. Right now I've gone into my bluehost control panel and replaced the style.css file. I also went into the custom css and deleted any css I had there to make sure there was nothing there that could possibly over ride it. But still if you go to the website you will see there are 2 stylesheets. I even searched my wordpress admin panel to make sure I didn't cache anything but I don't have a caching plugin. so that leads me to assume I messed up in the php somewhere but I'm not sure.

So when you go to the website and open the inspector and go to the sources you will see 2 stylesheets. style.css?ver=4.9.1 (the right one) and style.css?ver=1.0 (the old one). The old style sheet is making the navbar invisible and justifying the contact form to the left. The new stylesheet fixes those issues but for whatever reason the old stylesheet persists to exist and override the changes.

www.mustafasprojects.com

here's the header:

<!doctype html>
<html <?php language_attributes(); ?> class="no-js">
    <head>
        <meta charset="<?php bloginfo('charset'); ?>">
        <title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>

        <link href="//www.google-analytics.com" rel="dns-prefetch">

        <link href="<?php echo get_template_directory_uri(); ?>/img/icons/touch.png" rel="apple-touch-icon-precomposed">

        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <meta name="description" content="<?php bloginfo('description'); ?>">

        <?php wp_head(); ?>
        <script>
        // conditionizr.com
        // configure environment tests
        conditionizr.config({
            assets: '<?php echo get_template_directory_uri(); ?>',
            tests: {}
        });
        </script>

    </head>
    <body <?php body_class(); ?>>

        <div id="page-wrapper">

here's the function.php

// Load any external files you have here

function theme_styles() {
    wp_enqueue_style( 'bootstrap_css', 'http://maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css' );
    wp_enqueue_style( 'b_css', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css' );
    wp_enqueue_style( 'style_css', get_template_directory_uri() . '/style.css' );
}

add_action( 'wp_enqueue_scripts', 'theme_styles' );

function theme_js() {
    wp_enqueue_script( 'bootstrap_js', 'https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js');
}

add_action( 'wp_enqueue_scripts', 'themes_js');

add_action('wp_enqueue_scripts', 'add_my_script'); // initiate the function  

function add_my_script() {
wp_register_script ( 'colorbox-min' , get_stylesheet_directory_uri() . '/js/jquery.colorbox-min.js', array( 'jquery' ), '1', true );
wp_enqueue_script( 'colorbox-min' );

// Commented out because you probably want to use the minified version of the script
//wp_register_script ( 'colorbox' , get_stylesheet_directory_uri() . '/js/jquery.colorbox.js', array( 'jquery' ), '1', true );
//wp_enqueue_script( 'colorbox' );

wp_register_style ('ihatecolorboxcss', get_stylesheet_directory_uri() . '/ihatecolorbox.css','', '1', 'all');
wp_enqueue_style( 'colorbox' );
}

edit: other place I hooked in a style sheet

function html5blank_styles()
{
    wp_register_style('normalize', get_template_directory_uri() . '/normalize.css', array(), '1.0', 'all');
    wp_enqueue_style('normalize'); //

    wp_register_style('html5blank', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');
    wp_enqueue_style('html5blank'); 

Upvotes: 0

Views: 338

Answers (2)

miknik
miknik

Reputation: 5941

You are loading two, this one in functions

wp_enqueue_style( 'style_css', get_template_directory_uri() . '/style.css' );

and this one in your hook, adding v1.0 to the end

wp_register_style('html5blank', get_template_directory_uri() . '/style.css', array(), '1.0', 'all');

Enqueued with different names, but both have the same url

Upvotes: 1

Elyes At.
Elyes At.

Reputation: 55

In your code replace this line:

wp_enqueue_style( 'style_css', get_template_directory_uri() . '/style.css' );

with:

wp_enqueue_style( 'style_css', get_template_directory_uri() );

Upvotes: 0

Related Questions