当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

テンプレートタグ/the title

提供: WordPress Codex 日本語版
移動先: 案内検索

説明

現在の投稿のタイトルを表示、あるいは返します。必ずループの中で使用してください。ループの外では get_the_title() を使います。 投稿の公開状態がパスワード保護(protected)や非公開(private)であった場合、"Protected: " や "Private: " といった注釈がタイトルの前に追加されます。

使い方

<?php the_title( $before, $after, $echo ); ?>

パラメータ

$before
文字列) (オプション) タイトルの前に置くテキスト
初期値: なし
$after
文字列) (オプション) タイトルの後ろに置くテキスト
初期値: なし
$echo
真偽値) (オプション) タイトルを表示(TRUE)または返します(FALSE)。
初期値: TRUE

使用例

<?php the_title( '<h3>', '</h3>' ); ?>

これは、(HTML の)h3 として画面にタイトルを表示します。

メモ

変更履歴

0.71 にて導入されました。

ソースファイル

the_title()wp-includes/post-template.php にあります。

関連

投稿タグ: body_class(), next_image_link(), next_post_link(), next_posts_link(), post_class(), post_password_required(), posts_nav_link(), previous_image_link(), previous_post_link(), previous_posts_link(), single_post_title(), sticky_class(), the_category(), the_category_rss(), the_content(), the_content_rss(), the_excerpt(), the_excerpt_rss(), the_ID(), the_meta(), the_shortlink(), the_tags(), the_title(), the_title_attribute(), the_title_rss(), wp_link_pages(),


関数リファレンステンプレートタグ目次もご覧ください。


最新英語版: WordPress Codex » Function Reference/the_title最新版との差分