各ページ右上の画像広告経由でコンピュータウィルスがダウンロードされた可能性があります。ウィルスチェックをお願いします。詳しくは http://bono.s201.xrea.com/2008/06/693-virus_by_xrea_ad/ をご覧ください。ご迷惑をおかけしてしまい大変申し訳ありません。

テンプレートタグ/the excerpt

出典: ps*wiki

  • 書式: <?php the_excerpt(); ?>
  • 説明: 記事の概要を出力。画像などは取り除かれる。抜粋されずに長文となるときは日本語・マルチバイト特有の問題を参照。
  • 位置: ループ内
  • 引数: なし

目次

説明

Displays the excerpt of the current post with [...] at the end, which is not a "read more" link. If you do not provide an explicit excerpt to a post (in the post editor's optional excerpt field), the first 55 words of the post's content are used. Also in the latter case, HTML tags and graphics are stripped from the excerpt's content. This tag must be within The Loop.

使い方

<?php the_excerpt(); ?>

用例

初期設定での使用

Displays the post excerpt. Used on non-single/non-permalink posts as a replacement for the_content() to force excerpts to show within the Loop.

<?php the_excerpt(); ?>

Use with Conditional Tags

Replaces the_content() tag with the_excerpt() when on archive (tested by is_archive()) or category (is_category()) pages.

Both the examples below work for versions 1.5 and above.

<?php if(is_category() || is_archive()) {
	the_excerpt();
} else {
	the_content();
} ?>

For versions of WordPress prior to 1.5, only the following will work :

<?php if($cat || $m) {
	the_excerpt();
} else {
	the_content();
} ?>

パラメータ

This tag has no parameters.

the_ID, the_title, the_title_attribute, single_post_title, the_title_rss, the_content, the_content_rss, the_excerpt, the_excerpt_rss, previous_post_link, next_post_link, posts_nav_link, the_meta


原文・最新版: WordPress Codex » Template Tags/the_excerpt最新版との差分

このページ「テンプレートタグ/the excerpt」は未翻訳です。和訳してくださる協力者を求めています。和訳される際には最新版との差分を確認して、できればそれも反映してください。

MediaWiki
他の言語