• Resolved dunkkan

    (@dunkkan)


    Hello guys,

    I’d like a feature that gives me the custom excerpt if it exist, print nothing if he’s not there (as normally you’d get the default excerpt).

    Do you know how it could be done ?

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • In a post loop, the variable $post->post_excerpt will contain the excerpt you ‘handcrafted’.

    <?php
    echo '<p>the handcrafted excerpt' . $post->post_excerpt . '</p>';
    echo '<p>the_excerpt function </p>';
    the_excerpt();
    
    if ( !empty( $post->post_excerpt ) ) {
    echo ' you handcrafted an excerpt';
    }
    
    ?>
    Thread Starter dunkkan

    (@dunkkan)

    Wow Michael that’s pure goodness. Thanks very much.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘if custom excerpt echo, else null’ is closed to new replies.