the_content

Sponsored Link

現在の記事の内容を表示します。このタグは、The_Loop内にする必要があります。

Sponsored Link

クイックタグは、抜粋された記事の”cut-off”のポイントを指定するために使用された場合、the_content()タグはnon-single/non-permalinkの投稿ページにクイックタグの抜粋をして表示します。仕様では、the_content()のタグは、完全な記事への”continue reading”を作成しているのコンテンツの書式設定のためのパラメーターを含んで見ていきます。

Displays the contents of the current post. This tag must be within The_Loop.

If the quicktag is used in a post to designate the “cut-off” point for the post to be excerpted, the_content() tag will only show the excerpt up to the quicktag point on non-single/non-permalink post pages. By design, the_content() tag includes a parameter for formatting the content and look, which creates a link to “continue reading” the full post.

Note about :

  • 空白はのクイックタグの中の”more”の前に許可されていません。 言い換えれば、が動作しません!
  • クイックタグは、1つだけ記事が表示されているsingle.phpなどではテンプレートでは無視され動作しません。
  • 記事を読むの詳細については、Read Moreをカスタマイズするを読んでください。
  • No whitespaces are allowed before the “more” in the quicktag. In other words will not work!
  • The quicktag will not operate and is ignored in Templates, such as single.php, where just one post is displayed.
  • Read Customizing the Read More for more details.

the_contentのテンプレートタグ使用方法

<?php the_content( $more_link_text, $strip_teaser, $more_file ); ?>

どのようにPHPの関数スタイルのパラメーターを持つタグにパラメータを渡すのか

How to pass parameters to tags with PHP function-style parameters

the_contentのパラメーター

$more_link_text

(string) (optional)”more”のリンクを表示するリンクテキストです。

(string) (optional) The link text to display for the “more” link.

Default: ‘(more…)’

$strip_teaser

(boolean) (optional) “more”リンクの前のテキスト(TRUE)を非表示にされるか(FALSE)を表示します。

(boolean) (optional) Should the text before the “more” link be hidden (TRUE) or displayed (FALSE).

Default: FALSE

$more_file

(string) (optional) ファイルの”more”のリンクポイント(使用されなくなりました)。

(string) (optional) File the “more” link points to (no longer used).

Default: The current file

“More”テキストを指定シンボルする方法

クイックタグを使う時、詳細リンクテキストのために”Read more…”を使用して、現在の記事を表示します。

Displays the content of the post and uses “Read more…” for the more link text when the Quicktag is used.

<?php the_content('Read more...'); ?>

“More”にタイトルを含む方法

上記の例に似ていますが、the_title()にタグのおかげで、パラメーターを表示します。
クイックタグを使用する時 “Continue reading ACTUAL POST TITLE”を表示する事が出来ます。

Similar to the above example, but thanks to the_title() tag and the display parameter, it can show “Continue reading ACTUAL POST TITLE” when the Quicktag is used.

<?php the_content("Continue reading " . the_title('', '', false)); ?>

最も重要なアーカイブ/シングルページの動作

the_content()が、あなたが望む(例えば、クイックタグをコンテンツの上部にしたい時だけ記事の全文を表示する場合)ように動作していない場合、グローバル$moreで動作をオーバーライトする事が出来ます。

If the_content() isn’t working as you desire (displaying the entire story when you only want the content above the Quicktag, for example) you can override the behavior with global $more.

<?php 
global $more;// Declare global $more (before the loop).
$more = 0;   // Set (inside the loop) to display content above the more tag.
the_content("More...");
?>

すべてのコンテンツの表示が必要な場合:

if you need to display all of the content:

<?php 
global $more;// Declare global $more (before the loop).
$more = 1;   // Set (inside the loop) to display all content, including text below more.
the_content();
?>

代替利用

あなたはget_the_content()の代わりに、コンテンツの値を直接出力して返すために使用できます。例:

You may use get_the_content() to return the content value instead of outputting it directly. Example:

<?php $content = get_the_content(); ?>

ご注意ください! get_the_contentはフィルタなしのコンテンツを返します。あなたはthe_content()が返す同じ出力を実現したい場合、次のコードを使用してください:

Please note! get_the_content will return the unfiltered content. If you want to achieve the same output that the_content() returns, use the following code:

<?php
$content = apply_filters('the_content', $content);
$content = str_replace('&#93;&#93;>', ']]&amp;gt;', $content);
?>

変更ログ

Since: 0.71

ソースファイル

the_content()はwp-includes/post-template.php内に位置しています。

the_content() is located in wp-includes/post-template.php.

関連テンプレートタグ

the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, wp_link_pages, next_post_link, next_posts_link, previous_post_link, previous_posts_link, posts_nav_link, sticky_class, the_meta

Sponsored Link