문제

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