0
<?php

/*
# =======================================
# functions.php
#
# The theme's Function
# =======================================

*/

/*---------------------------------------*/
/* 1. CONSTANTS */
/*---------------------------------------*/

define('THEMEROOT', get_stylesheet_directory_uri());
define('IMAGES', THEMEROOT.'/img');
define('JS', THEMEROOT.'/js');


/*---------------------------------------*/
/* 2. SCRIPTS */
/*---------------------------------------*/
if(!function_exists('hydrogen_scripts')) {
    function hydrogen_scripts () {

        /* Load the stylesheets. */
        wp_enqueue_style( 'style', THEMEROOT . 'style.css' );
    }
    add_action('wp_enqueue_scripts', 'hydrogen_scripts');

}

What mistake am I doing that this is not able to load the style.css? Any idea? Looks like some subtle mistake that is not visible.

1
  • Glad to hear, thanks! Not sure about the downvote. Remembering what functions do/don't return a trailing slash can be tricky. There is a function called trailingslashit( $string ) which will add a trailing slash if $string does not already have one. Commented Jan 19, 2017 at 4:54

1 Answer 1

0

The URL returned by get_stylesheet_directory_uri() does not have a slash, so you need to add one .E.g.:

wp_enqueue_style( 'style', THEMEROOT . '/style.css' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.