bloginfo( string $show = '' )
显示当前站点的信息。一般都是后台可以设置的选项,包括常规选项和用户设置里的信息。
bloginfo()
会直接输出获取到的值,如果要获取返回值的话,请看 get_bloginfo()
。
默认参数:name
$show
包含的可能值:
设置>常规
中设置的“站点标题”。从 wp_options 表中的“blogname”记录中检索此数据。设置>常规
中设置的“副标题”。此数据从 wp_options 的“blogdescription”记录中检索。设置>常规
中设置的“WordPress地址(URL)”。此数据从 wp_options 表中的“siteurl”记录中检索。可以考虑使用 home_url() 代替,尤其是对于使用路径进行区分而不是使用子域名的多站点(它返回的是根站点而不是当前的子站点)。wp-includes/version.php
定义的 $wp_version
这个变量的值。text/tml
)。此数据从wp_options表中的“html_type”记录中检索。主题和插件可以使用pre_option_html_type
过滤器覆盖默认值。is_rtl()
代替。get_stylesheet_uri()
代替。get_stylesheet_directory_uri
代替。get_bloginfo('template_url')
和get_template
都将返回父主题的目录。应该使用 get_template_directory_uri()
(对于父模板目录)或get_stylesheet_directory_uri()
(对于子模板目录)。RDF/RSS 1.0
feed URL(/feed/rfd)。RSS 0.92
feed URL(/feed/rss)。RSS 2.0
feed URL(/feed)。RSS 2.0
feed URL(/comments/feed)。home_url()
代替。home_url()
代替。wp-includes/general-template.php
<?php
...
function bloginfo( $show = '' ) {
echo get_bloginfo( $show, 'display' );
}
...
?>
站点地址(URL) 显示的是 http://www.example.com/home
, WordPress 地址 (URL) 是安装在 http://www.example.com/home/wp
admin_email = [email protected]
atom_url = http://www.example.com/home/feed/atom
charset = UTF-8
comments_atom_url = http://www.example.com/home/comments/feed/atom
comments_rss2_url = http://www.example.com/home/comments/feed
description = Just another WordPress blog
home = http://www.example.com/home (DEPRECATED! use url option instead)
html_type = text/html
language = en-US
name = Testpilot
pingback_url = http://www.example.com/home/wp/xmlrpc.php
rdf_url = http://www.example.com/home/feed/rdf
rss2_url = http://www.example.com/home/feed
rss_url = http://www.example.com/home/feed/rss
siteurl = http://www.example.com/home (DEPRECATED! use url option instead)
stylesheet_directory = http://www.example.com/home/wp/wp-content/themes/largo
stylesheet_url = http://www.example.com/home/wp/wp-content/themes/largo/style.css
template_directory = http://www.example.com/home/wp/wp-content/themes/largo
template_url = http://www.example.com/home/wp/wp-content/themes/largo
text_direction = ltr
url = http://www.example.com/home
version = 3.5
wpurl = http://www.example.com/home/wp
相关函数:get_bloginfo()
官方文档:https://developer.wordpress.org/reference/functions/bloginfo/
Copyright 2019 我是菜鸟我想飞 . All Rights Reserved. Theme Elsa By Maine
https://s23.cnzz.com/z_stat.php?id=1275758743&web_id=1275758743
1个回复