[英]how to show wordpress site title and tagline?
I'm trying to put site title and tagline in child theme header. 我正在尝试将网站标题和标语放在子主题标题中。 I searched about it and find these two different wordpress functions get_bloginfo() and bloginfo() .
我搜索了它,找到了这两个不同的wordpress函数get_bloginfo()和bloginfo() 。
get_bloginfo()
doesn't showing the tagline, and bloginfo()
showing both site title and tagline. get_bloginfo()
不显示标语,而bloginfo()
显示网站标题和标语。 Problem is that bloginfo()
is removing the :
and space between site title and description. 问题是
bloginfo()
正在删除:
和网站标题和描述之间的空格。
<title><?php bloginfo( 'name' ) . ' : '. bloginfo( 'description' ); ?></title>
Title: WebsiteThis is example website. 标题: WebsiteThis是示例网站。
You can see there is no space between Website
and This
. 您可以看到
Website
与This
之间没有空格。
So is this possible that i show the site title and tagline with properly space and :
? 那么这可能是我用适当的空间显示网站标题和标语,并且
:
This will help you. 这会对你有所帮助。
<title> <?php $site_description = get_bloginfo( 'description', 'display' ); $site_name = get_bloginfo( 'name' ); //for home page if ( $site_description && ( is_home() || is_front_page() ) ): echo $site_name;echo ' | '; echo $site_description; endif; // for other post pages if (!( is_home() ) && ! is_404() ): the_title(); echo ' | '; echo $site_name; endif; ?> </title>
Try this 尝试这个
<title><?php echo get_bloginfo( 'name' ) . ' : '. get_bloginfo( 'description' ); ?></title>
echo get_option('blogname'); // For Site Name
echo get_option('blogdescription'); // For Tag line or description
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.