getting url in wp_enqueue_style

I’m having trouble getting the second argument in wp_enque_style. Here’s how my site is setup:

  • style.css
  • custom_style.css
  • index.php

In a template, I have this code:

Read More
$stylesheet_url = bloginfo('template_directory') . '/custom_style.css'; 
wp_enqueue_style( 'custom_style', $stylesheet_url ); 

Which isn’t working. Any reasons why?

The output is just the path to my template directory, outputted as raw text, which is obviously not the correct behavior.

Related posts

Leave a Reply

2 comments

  1. To enqueue extra styles you should place the following code in your functions.php

    function my_custom_styles() {
        wp_enqueue_style( 'custom-style', get_stylesheet_directory_uri() . '/custom_style.css');
    }
    add_action( 'wp_print_styles', 'my_custom_styles' );