WordPress.org

Ready to get started?Download WordPress

Forums

Having issue with WordPress wp_enqueue_style/script (4 posts)

  1. gutterboy333
    Member
    Posted 1 year ago #

    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!

  2. codingpet
    Member
    Posted 1 year ago #

  3. gutterboy333
    Member
    Posted 1 year ago #

    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'));
    
    }
  4. gutterboy333
    Member
    Posted 1 year ago #

    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. ]

Topic Closed

This topic has been closed to new replies.

About this Topic