当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
万が一、当サイトで重大な問題を発見した際などは、フォーラムや WordSlack #docs チャンネルでお知らせください。</p>
テンプレートタグ/single post title
提供: WordPress Codex 日本語版
< テンプレートタグ
説明
個別記事ページでループ外に記事のタイトルを出力します。 このタグはループの外に投稿のタイトルを表示する場合に便利です。
使い方
<?php single_post_title( $prefix, $display ); ?>
デフォルトの使い方
<?php single_post_title(); ?>
パラメータ
- $prefix
- (文字列) (オプション) 記事タイトルの前に出力するテキスト。デフォルトでは空。
- 初期値: なし
- $display
- (真偽型) (オプション) 取得した値の処理方法。Should the title be displayed (TRUE) なら記事タイトルをページ内に出力、(FALSE)の場合は、PHPで使用できる値として記事タイトルを返す。
- 初期値: TRUE
用例
<h2><?php single_post_title( 'Current post: ' ); ?></h2>
Current post: Single Post Title
更新履歴
新規導入: 0.71
ソースファイル
single_post_title() は wp-includes/general-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/single_post_title (最新版との差分)