WordPress.org

Ready to get started?Download WordPress

Forums

Insert text via theme inside the_excerpt() (5 posts)

  1. dnovo
    Member
    Posted 8 years ago #

    Confused? Let me explain. When a post is over 600 words, I have a little bit of php that inserts the contents of the_excerpt() before the_content() is displayed. Long post, present readers with a summary, so they can decide if they want to read the whole thing.

    Works great.

    I wish to call this section "Long Post Summary" or somesuch, and format it so that it looks like this:

    Long Post Summary: This post is about bunnies, and their cuteness and whatnot. Very long, I'm sorry, but this summary should help.

    I want the "Long Post Summary" in the theme, so I don't have to remember to enter it in each post, but the_excerpt() surrounds itself with p tags, so anything in the theme before it is outside of that, and the actual excerpt starts a new paragraph... it looks like this:

    Long Post Summary:

    This post is about bunnies, and their cuteness and whatnot. Very long, I'm sorry, but this summary should help.

    I want to insert the bolded text inside the paragraph of the_excerpt(), from the theme.

    Can I?

    How?

    Thanks,

    Danny.

  2. Kafkaesqui

    Posted 8 years ago #

    Look at using the_excerpt_rss(), which doesn't wrap paragraph tags around the excerpt.

  3. dnovo
    Member
    Posted 8 years ago #

    Hm. I replaced the_excerpt() with the_excerpt_rss(), and it does seem to wrap it in paragraph tags. And I was so hopeful. This is with WP 1.5.

    Did I mess up somewhere? Should it have worked? Cause it does not seem to work.

    Danny.

  4. Kafkaesqui

    Posted 8 years ago #

    I don't know if you're doing anything wrong, but I do know that the_excerpt_rss() does not place a <p> element around the excerpt. Is it possible you changed it in one template but were looking at another?

  5. dnovo
    Member
    Posted 8 years ago #

    I can't figure out what I am doing wrong, then. I'm now up to Wp 1.5.1, same issue. Here is the template code in question...

    echo "<small><div class=\"summary\">";
    echo "<strong>Long Post Summary:</strong> ";
    the_excerpt_rss();
    echo "</div></small>";

    Does this help you help me?

Topic Closed

This topic has been closed to new replies.

About this Topic