0

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.

What I have 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!?

I also tried putting the below in my themes functions.php file but got the same results.

add_action( 'after_setup_theme', 'mmw_new_theme_setup' );

function mmw_new_theme_setup() {

    /* Add theme support for post formats. */   
    add_theme_support( 'post-formats' );

    /* Add theme support for post thumbnails. */    
    add_theme_support( 'post-thumbnails' );

    /* Add theme support for automatic feed links. */   
    add_theme_support( 'automatic-feed-links' );

    /* Add theme support for menus. */  
    add_theme_support( 'menus' );

    /* 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'));

}

Thanks!

1 Answer 1

2

I just found you using function bloginfo() which echo out the value, You should use get_bloginfo() function to pass the value to varibales - $foo, $bar and to the function wp_enqueue_style().

11
  • I changed it, but no change. Still getting the paths output as noted above.
    – Brett
    Aug 19, 2012 at 9:13
  • OK, found it - use get_bloginfo() function to get the value.
    – Amit Kosti
    Aug 19, 2012 at 9:32
  • That's awesome. Thanks so much for picking that up. One more question though, how do you manage this if you only need a certain style for IE and need to use the conditional tags? Do you need to load it via the header?
    – Brett
    Aug 19, 2012 at 9:57
  • You've to manually add that into header.php, Or use This plugin (Not tested)
    – Amit Kosti
    Aug 19, 2012 at 11:09
  • How do you make sure it comes after other styles?
    – Brett
    Aug 19, 2012 at 11:28

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.