has_excerpt()

Sponsored Link

現在の投稿に抜粋がある場合です。

Sponsored Link

原文(翻訳元)When the current post has an excerpt

has_excerpt(’42’)

投稿42(ID)に抜粋がある場合です。

原文(翻訳元)When the post 42 (ID) has an excerpt.

<?php
// Get $post if you're inside a function
global $post;

if ( empty($post->post_excerpt) ) {
    // This post has no excerpt
} else {
    // This post has excerpt
}
?>

他の使い方

自動表示の抜粋を隠す必要があり、投稿の抜粋が表示のみの場合です。

原文(翻訳元)when you need hide the excerpt auto displayed and only display yours posts excerpts.

<?php if ( !has_excerpt()) {
      echo '';
} else { 
      the_excerpt();
}
&#91;/php&#93;

<p>テキストかコードに自動抜粋に置き換えます。</p>
<blockquote><img src="http://lovelog.eternal-tears.com/wp-content/uploads/2008/07/img_english.gif" alt="原文(翻訳元)" height="13" width="13"/>Replace auto excerpt for a text or code.</blockquote>
<?php if ( !has_excerpt() ) {?>
    <!-- you text or code -->
<?php } ?>
Sponsored Link