$path = bloginfo('template_url');
$image_url = $path.'image.jpg';
我不知道爲什麼,但$path = bloginfo('stylesheet_directory');
沒有echo
正在顯示的URL,任何想法問題出在哪裏?WordPress的圖像URL
$path = bloginfo('template_url');
$image_url = $path.'image.jpg';
我不知道爲什麼,但$path = bloginfo('stylesheet_directory');
沒有echo
正在顯示的URL,任何想法問題出在哪裏?WordPress的圖像URL
是bloginfo
自動顯示屬性(在返回null時)。我想你想使用get_bloginfo
:
$path = get_bloginfo('stylesheet_directory');
$image_url = $path.'image.jpg';
代碼bloginfo()始終打印結果到瀏覽器。如果您需要PHP中使用的值,請嘗試使用get_bloginfo()。
您必須使用template_directory
代替template_url
<?php get_bloginfo('template_directory').'image.jpg'; ?>
U可以使用'template_directory' – Ehsan