Combining the_excerpt with the_content

I have some html:

<div class="container">
<p class="accent">The first paragraph...</p>
<p>The rest of the article...</p>
</div>

I’d like to put “the_excerpt” in the first paragraph (with a special colour / font size) but then have the following text be “normal”.

Read More

Is there a way to subtract the_excerpt from the_content so the section “The rest of the article” does not repeat the excerpt?

Related posts

Leave a Reply

2 comments

  1. The key is to use user-defined excerpts, rather than auto-generated excerpts. For example:

    <div <?php post_class(); ?>>
    <?php
    // If post has defined excerpt, output it here
    if ( has_excerpt() ) {
        ?>
        <div class="first-paragraph-excerpt">
        <?php the_excerpt(); ?>
        </div>
        <?php
    }
    // Now output the content
    the_content();
    ?>
    </div> <!-- .post -->
    

    You’ll need to adapt to your needs, but this will output a div with the Excerpt, if it exists, and then output the content.

  2. Maybe doing it with css?

    .container p:first {
        font-weight: bold;
    }
    

    And the html from your example:

    <div class="container">
    <p>The first paragraph...</p>
    <p>The rest of the article...</p>
    </div>