wp_title()返回值无法设置样式 [英] wp_title() return value can't be styled
本文介绍了wp_title()返回值无法设置样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
标题显示在我的图像之前,并且未设置样式。
The title is displayed before my image and is not styled. How to fix it?
$tytul = wp_title();
echo '<img class="icon" src="http://site.pl/site/icon.png" /><h2>'.$tytul.'</h2>';
推荐答案
wp_title()
将打印内容本身,而不返回内容,因此 echo wp_title()
不会从回显中提供任何内容,但会打印标题。如果使用 var_dump(wp_title())
,则会看到标题,结果为 NULL
。您想要的是:
wp_title()
will print the content itself, not return it, so echo wp_title()
wont give you anything from the echo, but will print the title. If you use var_dump(wp_title())
, you will see the title, then the result is NULL
. What you want is:
echo '<img class="icon" src="http://site.pl/site/icon.png" /><h2>';
wp_title();
echo '</h2>';
这篇关于wp_title()返回值无法设置样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文