Best href for stylesheet?

Hi - does anyone perhaps know what’s the difference between:

href="<?php echo get_stylesheet_uri(); ?>"


href="<?php bloginfo('stylesheet_url'); ?>"

I always used the 2nd one but now the blankslate theme I downloaded uses the first one.

thanks, Val

There is no difference as bloginfo(‘stylesheet_url’) uses get_stylesheet_uri() to get the value

Also, documentation says:

‘stylesheet_url’ - Displays the primary CSS (usually style.css) file URL of the active theme. Consider echoing get_stylesheet_uri() instead.

Thanks! I don’t know why I have to echo instead but since they say it and since blankslate keeps itself updated, I’ll do it :slight_smile:

I think because it allows you to skip one extra function call. When you use bloginfo it calls get_stylesheet_uri so why not to use the latter directly without any mediators

oh that makes sense, thanks so much!

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.