WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Manual Excerpts or Full Content ONLY?

[Resolved] Manual Excerpts or Full Content ONLY?

  • 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 != '' ){
    	the_excerpt();
    } 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

    John

Viewing 1 replies (of 1 total)
  • 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();

    becomes

    $blog_ex = $post->post_excerpt;

    and it now functions as required.

    J

Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Manual Excerpts or Full Content ONLY?’ is closed to new replies.