Called the images in my theme as shown below

<img src="<?php bloginfo ('stylesheet_directory');?>/images/blogo.png" />

It worked perfectly until I installed a Child Theme. I had to change

<?php bloginfo ('stylesheet_directory');?>

to

<?php bloginfo ('template_directory');?>

Before it started working again. Just need help understanding why that happened. Thanks

有帮助吗?

解决方案

stylesheet_directory is the directory that contains the main stylesheet in use (so if you have a child template then it would be the child directory. If not, it will be the template directory.

template_directory is the directory of your parent theme.

Look at the codex for more details

其他提示

Stylsheet directory links to the main stylesheet, and not the child theme( since the child theme may not contain the style.css by default, it inherits the style.css of parent theme. So the parent path is called if you are using this).

So always use get_stylesheet_uri() or get_template_directory_uri() for these purpose.

Hope this clarifies you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top