- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
テンプレートタグ/language attributes
提供: WordPress Codex 日本語版
この項目「テンプレートタグ/language attributes」は、翻訳チェック待ちの項目です。加筆、訂正などを通して、Codex ドキュメンテーションにご協力下さい。
<html>
タグ用に言語属性を表示します。表示され得るのは dir
(テキストの向き)、lang
、xml:lang
です。lang
と xml:lang
の内容は $doctype
引数によって決まります。
使い方
<?php language_attributes( $doctype ); ?>
パラメータ
- $doctype
- (文字列) (オプション) HTML ドキュメントの種類。'xhtml' または 'html'。
- 初期値: 'html'
戻り値
- (void)
- この関数は値を返しません。
用例
<!DOCTYPE html> <html <?php language_attributes(); ?>> <head> ...
(出典: wp-content/themes/twentyten/header.php
)
参考
- 関数 is_rtl() を使ってテキストの向きを判定します。
- 関数 get_bloginfo() を使って 'language' を取得します。
- 関数 apply_filters() を使って、文字列にフィルター 'language_attributes' を適用してから表示します。
変更履歴
新規導入: 2.1.0
ソースファイル
language_attributes() は wp-includes/general-template.php
にあります。
関連項目
- Theme Review - ガイドライン(指針) -- このテンプレートタグは公式テーマディレクトリに登録するテーマに必須です。
最新英語版: WordPress Codex » Function Reference/language attributes (最新版との差分)