Languages: English • 日本語 Português do Brasil • 中文(简体) • (Add your language)
显示你博客的信息,大多数情况是在Administration中的User Profile 和 General Options中你输入的信息 (Settings → General). It can be used anywhere within a page template. This always prints a result to the browser. If you need the values for use in PHP, use get_bloginfo().
<?php bloginfo( $show ); ?>
注意所有url末尾都不带斜杠"/"。 If using child-theme, that has parent-theme as the parent. 使用没有参数的bloginfo(),会默认为bloginfo(' name ')。 .
name = Testpilot description = Just another WordPress blog admin_email = admin@example url = http://example/home wpurl = http://example/home/wp stylesheet_directory = http://example/home/wp/wp-content/themes/child-theme stylesheet_url = http://example/home/wp/wp-content/themes/child-theme/style.css template_directory = http://example/home/wp/wp-content/themes/parent-theme template_url = http://example/home/wp/wp-content/themes/parent-theme atom_url = http://example/home/feed/atom rss2_url = http://example/home/feed rss_url = http://example/home/feed/rss pingback_url = http://example/home/wp/xmlrpc.php rdf_url = http://example/home/feed/rdf comments_atom_url = http://example/home/comments/feed/atom comments_rss2_url = http://example/home/comments/feed charset = UTF-8 html_type = text/html language = en-US text_direction = ltr version = 3.1
在<h1>标签中显示你的博客标题。
<h1><?php bloginfo('name'); ?></h1>
Displays your blog's title in a link.
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>
显示博客正在使用的字符集(如: utf-8)。
<p>Character set: <?php bloginfo('charset'); ?> </p>
Displays Tagline for your blog as set in the Administration panel under General Options.
<p><?php bloginfo('description'); ?> </p>
标签 bloginfo()位于 wp-includes/general-template.php
.
WordPress Directories: | ||
---|---|---|
home_url() | Home URL | http://www.example.com |
site_url() | Site directory URL | http://www.example.com or http://www.example.com/wordpress |
admin_url() | Admin directory URL | http://www.example.com/wp-admin |
includes_url() | Includes directory URL | http://www.example.com/wp-includes |
content_url() | Content directory URL | http://www.example.com/wp-content |
plugins_url() | Plugins directory URL | http://www.example.com/wp-content/plugins |
theme_url() | Themes directory URL (#18302) | http://www.example.com/wp-content/themes |
wp_upload_dir() | Upload directory URL (returns an array) | http://www.example.com/wp-content/uploads |