bloginfo('stylesheet_directory') vs. get_stylesheet_directory_uri() and include('file.php') vs. get_template_part()

wordpress.stackexchange https://wordpress.stackexchange.com/questions/75970

  •  04-11-2019
  •  | 
  •  

Question

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.

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top