模板标签/bloginfo

来自WordPress中文文档
跳转至: 导航搜索

wordpress.org.cn

描述

显示你博客的信息,大多数情况是在Administration中的User ProfileGeneral 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>

备注

Change Log

  • Since: 0.71

源文件位置

标签 bloginfo()位于 onlyincludecodewp-includes/general-template.php/code/onlyinclude

div class=template-description style=padding: 0 1.5em; border: 1px solid #eeeeee; background-color: #f9f9f9

Template Description

Link to the source code on http://core.trac.wordpress.org/browser/.

Parameters

  1. filename
  2. (option) path to codetag/code (version) or codetrunk/code. This option is only used for a new function.br /Default: codetrunk/code -- trunk is the latest bleeding edge development version of WordPress.

Usage

Link to the stable version: pre检查到模板循环:模板:Trac/pre

Link to trunk: pre检查到模板循环:模板:Trac/pre

/div

wordpress.org.cn.

相关

目录的URL标记

模板:Directory URL Tags

includeonlydiv style=clear:both; background-color:#F7F7F7; border:1px solid #CCCCCC; color:#000000; padding:7px; margin:0.5em auto 0.5em auto; vertical-align:middle;See also index of Function Reference and index of Template Tags./div/includeonlynoinclude

Description

This Template is used by Codex:Template Messages.

Usage

pre 检查到模板循环:模板:Message /pre

Result

检查到模板循环:模板:Message

/noinclude