<?php echo esc_url( get_bloginfo( 'stylesheet_directory' ) ); ?>
Output
http://example.com/wp-content/themes/twentysixteen
Alternatives
Internally, get_bloginfo( 'stylesheet_directory' )
calls get_stylesheet_directory_uri()
, so you may want to use that instead:
<?php echo esc_url( get_stylesheet_directory_uri() ); ?>
Many developers prefer to use these dedicated functions because of inconsistent naming conventions between them and get_bloginfo()
. For example, get_stylesheet_directory()
returns the child theme path; however, as our previous example illustrates, get_bloginfo( 'stylesheet_directory' )
returns the child theme URL. If you use get_stylesheet_directory_uri()
instead, there's less chance of confusion over whether you're retrieving a path or a URL.