• Resolved semisara

    (@semisara)


    Hiya,

    I’ve searched around for info regarding this question but can’t seem to find anything.

    The magazine theme I’m using utilises excerpts (both custom and automatically-generated) on the front page, which isn’t a problem. On single entry pages, I’d like to use custom excerpt text as a standfirst/kicker below the entry title, but don’t want to go back and write custom excerpts for the hundreds of posts that already exist.

    Is there any way to have only custom excerpts display on single entry pages, while entries that have auto excerpts display nothing?

    Could this be done with existing WordPress codex? I saw something on this website that added new excerpt options through the functions.php file… is this a potential way?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this (I didn’t test it).

    In the template file for the single post page (usually single.php)
    add this below the code that displays the entry title

    <?php if ( has_excerpt() ) {
       <div class="standfirst">
          the_excerpt();
       </div>
    } ?>

    If there is a manual excerpt on a post, that code should display it.
    I wrapped it in a div so you can style the displayed content as desired.

    If there is no manual excerpt nothing will display.

    Thread Starter semisara

    (@semisara)

    Thank you very much! That works perfectly ??

    If anyone else stumbles upon this with the same question, after receiving your answer I also found the sites below:

    Display the_excerpt only if there is text

    Check if post has the_excerpt

    If the_excerpt() is blank?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Excluding automatic excerpts’ is closed to new replies.