- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/bloginfo
提供: WordPress Codex 日本語版
このページ「テンプレートタグ/bloginfo」は一部未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています。
目次
説明
サイトの情報を表示させる関数です。情報の殆どは、プロフィールや一般設定などの、WordPress 管理画面で入力されたものです。この関数はテンプレートファイルの至るところで使うことができ、その結果は常にブラウザーに表示されます。PHP の中でこれらの値を使う必要がある場合は、get_bloginfo() を用いてください。
使い方
<?php bloginfo( $show ); ?>
パラメータ
Note that directory URLs are missing trailing slashes. If using child-theme, that has parent-theme as the parent. Using bloginfo() without a parameter will default to bloginfo('name').
name = Testpilot description = Just another WordPress blog admin_email = admin@example url = http://example/home [use home_url('/') instead] wpurl = http://example/home/wp [use site_url('/') instead] 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>
リンク内でブログのタイトルを表示
ブログのタイトルをリンク内で表示。
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php bloginfo('name'); ?></a>
文字コードの表示
ブログで使われている文字コードの表示 (例: utf-8)
<p>Character set: <?php bloginfo('charset'); ?> </p>
ブログの概要(キャッチフレーズ)を表示
ダッシュボードの「設定」>「一般設定」で入力したキャッチフレーズを表示。
<p><?php bloginfo('description'); ?> </p>
注
- get_bloginfo() を使用。
変更履歴
- Since: 0.71
ソースファイル
bloginfo() は wp-includes/general-template.php
にあります。
最新英語版: WordPress Codex » Function Reference/bloginfo (最新版との差分)
関数リファレンス、テンプレートタグ目次もご覧ください。