php 显示 Wordpress 站点标题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18686523/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Display Wordpress Site Title
提问by Student
I want to display the Title of my Wordpress Site on the single blog posts pages.
我想在单个博客文章页面上显示我的 Wordpress 站点的标题。
I use the following line of code in my theme's 'single blog post.php'
我在主题的“single blog post.php”中使用了以下代码行
<h1><?php $site_title = get_bloginfo( 'name' ); ?></h1>
However it does not show anything.
但是,它没有显示任何内容。
回答by Sabari
You are not outputting anything to show. You are only assigning blog name to a variable. You need to echo the content. It should be :
你没有输出任何东西来显示。您只是将博客名称分配给变量。您需要回显内容。它应该是 :
<h1><?php echo get_bloginfo( 'name' ); ?></h1>
Hope this helps :)
希望这可以帮助 :)