The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

[resolved] Manual Excerpts or Full Content ONLY? (2 posts)

  1. SpankMarvin
    Posted 5 years ago #

    Hi all

    I thought this would be a relatively simple thing to achieve, but guess I'm missing something.

    I am setting up a blog in which, for listings, I want a manual excerpt to appear. No issues there, except that at the moment, if there is no excerpt put in, WordPress makes one automatically out of the content. I have the following code in the loop:

    <?php $blog_ex = get_the_excerpt();
    if( $blog_ex != '' ){
    } else {
    	the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) );
    } ?>

    My guess is that get_the_excerpt is already returning something automatically so that my variable is never == ''... so would filtering be the way to go?

    Any advice much appreciated


  2. SpankMarvin
    Posted 5 years ago #

    I figured this out! Instead of using the get_the_excerpt function, I used the post object to gauge whether a manual excerpt was added.

    $blog_ex = get_the_excerpt();


    $blog_ex = $post->post_excerpt;

    and it now functions as required.


Topic Closed

This topic has been closed to new replies.

About this Topic