WordPress.org

Support

Support » Themes and Templates » Having issue with WordPress wp_enqueue_style/script

Having issue with WordPress wp_enqueue_style/script

  • I am building a full design into WordPress for the first time and I am trying to load in stylesheets and script files but all I seem to be getting is the text output of the location for the main stylesheet and just a text output of the template URL for the others (reset.css and rhinoslider-1.05.css aren’t mentioned in the output).

    What I have for the styles is below..

    wp_enqueue_style('reset', bloginfo('template_url') . '/reset.css');
    wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));
    wp_enqueue_style('rhino', bloginfo('template_url') . '/rhinoslider-1.05.css', array('reset','style'));

    Do I need to put this inside the link tags or something? I thought it would do it all itself; as what’s the point loading it that way if it doesn’t do it itself? I know it makes sure the same file isn’t included twice or something, but if you have to include the link tags yourself and then WP decides not to include the file then you are left with blank link tags!?

    Thanks for any help!

Viewing 3 replies - 1 through 3 (of 3 total)
  • I already tried that by adding the below to the functions.php file but got the same results..

    add_action('after_setup_theme', 'mmw_new_theme_setup');
    
    function mmw_new_theme_setup() {
    
    	/* Load style files on the 'wp_enqueue_scripts' action hook. */
    	add_action( 'wp_enqueue_scripts', 'mmw_new_load_styles' );
    
    }
    
    function mmw_new_load_styles() {
    
        $foo = bloginfo('template_url') . '/reset.css';
        $bar = bloginfo('template_url') . '/rhinoslider-1.05.css';
    
        wp_enqueue_style('reset', $foo);
        wp_enqueue_style('style', bloginfo('stylesheet_url'), array('reset'));
        wp_enqueue_style('rhino', $bar, array('reset','style'));
    
    }

    Do you think it has anything to do with the URL having spaces in it hence the location containing a bunch of “%20”?

    [ Please do not bump, that’s not permitted here. ]

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Having issue with WordPress wp_enqueue_style/script’ is closed to new replies.
Skip to toolbar