Support » Fixing WordPress » If the_excerpt() is blank?

  • Resolved delete


    I am using the_content() and the_excerpt() on my index page. Its a resource site where we link to others. With the_content() (and more) we have our text and then we use the_excerpt() to quote the site we are linking to. The problem arises when we post our own articles. We have no need for the_excerpt() and need to not display it if we left it blank. However doing a simple if (the_excerpt()) doesn’t work since wordpress just uses content for it.

    Is there another way to do this? Since I have the_excerpt() wrapped with blockquote, is there a way to wrap the whole thing in an if statement?

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


    Was able to figure it out after some more browsing… For those interested in the same here is what mine looks like:

    <?php if (!get_the_excerpt()) { ?>
      <!-- show nothing if no ex
    <?php } else { ?>
      <?php the_excerpt(); ?>
    <?php } ?>

    Somebody else might have a better way to do this, but this works for me right now.

    Found this useful from

    if ( !empty( $post->post_excerpt ) ) :
    else :
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘If the_excerpt() is blank?’ is closed to new replies.