我在子目录中有一个与主题相关的gfx所在的图像文件夹。如果我想通过以下方式访问它:
<img src="<?php echo get_template_directory_uri();?>/assets/Logo.svg" />
它试图在父主题目录中查找/ assets。
如何引用子主题目录?
#1
函数get_template_directory_uri始终返回父主题的url。没关系, 在哪里叫它。
要获取你的子主题的网址, 可以使用get_stylesheet_directory_uri()。因此, 你的代码将是:
<img src="<?php echo get_stylesheet_directory_uri();?>/assets/Logo.svg" />
来源:
https://www.srcmini02.com/66411.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_40504.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57