Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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".

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

share|improve this question
1  
Is the excerpt generated automatically, from the post content? (by stripping tags, shortcodes etc) –  onetrickpony Apr 4 '12 at 16:27
    
Actually I used a different method because sometimes there's an excerpt that is "specially" entered...good point –  redconservatory Apr 4 '12 at 17:01
add comment

2 Answers

up vote 3 down vote accepted

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.

share|improve this answer
add comment

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>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.