• Resolved ganjigorka

    (@ganjigorka)


    Hey guys,

    So not sure why this isn’t working every tutorial I’ve read on the net says it should run without a hitch. the code is sitting in my functions.php of a custom theme I am writing (not a child theme).

    function my_assets() {
        wp_enqueue_style( 'style' , get_template_directory_uri() .'/style.css' );
        echo get_template_directory_uri() .'/style.css';
    }
    
    add_action( 'wp_enqueue_scripts', 'my_assets' );

    I’ve echoed the template directory to ensure it is pointing to the right place and it prints out the full path to the CSS file. I’ve tried using get_stylesheet_uri() in place of get_template_directory_uri().'/style.css' to no avail.

    Any help would be greatly appreciated.

    Cheers!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ganjigorka

    (@ganjigorka)

    Edit: It appears the action hook isn’t being called at all by wordpress without <?php do_action('wp_enqueue_scripts'); ?> being added to my header. With the do_action statement the function is definitely called as it prints out the stylesheet url, however the stylesheet still isn’t loaded. 🙁

    Thread Starter ganjigorka

    (@ganjigorka)

    Got it, needed to add wp_head() to my header! Doh!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp_enqueue_style not working’ is closed to new replies.