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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 18:01:32  来源:igfitidea点击:

Display Wordpress Site Title

phpwordpress

提问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 :)

希望这可以帮助 :)