wp_title() return value can't be styled [closed]

巧了我就是萌 提交于 2019-12-25 02:06:37

问题


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>';

回答1:


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>';


来源:https://stackoverflow.com/questions/15660000/wp-title-return-value-cant-be-styled

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!