WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my custom theme I'm using <img src="<?php bloginfo('stylesheet_directory'); ?>/images/logo.jpg"/> to load my custom logo.

I'm using a custom sidebar for front-page.php and that's why I used <?php include('sidebar-front.php') ?> to get it.

But when I'm using the 'theme-check' plugin it's suggesting to change the following:

  • bloginfo('stylesheet_directory') to get_stylesheet_directory_uri()
  • include() to get_template_part()

So, I did the following:

  • <img src="<?php get_stylesheet_directory_uri(); ?>/images/logo.jpg"/>, and
  • <?php get_template_part('sidebar-front.php') ?>

But both failed here. The logo doesn't load and the sidebar isn't too. I used <?php get_sidebar('front'); ?> and it's working fine.

I just want to speculate what the problem with those suggestions? It's WP 3.4.2 here.

share|improve this question
up vote 4 down vote accepted

get_stylesheet_directory_uri() returns a value, it doesn’t print anything. So you have to use:

echo get_stylesheet_directory_uri();

get_template_part() is just a wrapper for locate_template(). But the latter has one advantage: It returns the path of the file it has found. Try the following:

$path = locate_template( 'sidebar-front.php', TRUE );
echo $path;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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