WordPress.org

Ready to get started?Download WordPress

Forums

excerpt related question (11 posts)

  1. Jinsan
    Member
    Posted 9 years ago #

    WP automatically generates an excerpt if the_excerpt is used within the loop. It however strips the html and tags from the content.

    Using the c2c plugin I can call excerpts which include the tags and html.

    What I need is either a plugin or some method so that the site automatically generates an excerpt of say the first 20 words INCLUDING the tags and any HTML. I need this to be autogenerated as soon as I hit the publish button - in fact, be it publish, draft or whatever, I would like to add whatever the first 20 words including the code, are.

    Anyone know how I would accomplish something like this? Do existing excerpt plugins do this? I know many will generate the excerpt automatically, but only in the case of a search not as an actual exceprt within the post.

    Make sense?

    Cheers

  2. Kafkaesqui

    Posted 9 years ago #

    http://guff.szub.net/the-excerpt-reloaded

    Once I'm done with a new plugin I'm working on right now, I'll be updating the_excerpt Reloaded with a few more bells and whistles (as well as making it more post content-aware in regards to text formatting, the more quicktag, etc.).

  3. Jinsan
    Member
    Posted 9 years ago #

    Sounds promising Kaf, I'll keep an eye on it.

    Cheers

  4. RosieMBanks
    Member
    Posted 9 years ago #

    Me, too, and I thank you.

  5. Jinsan
    Member
    Posted 9 years ago #

    Hmm the more I read about this, I wonder if it will work in conjunction or seperately from the current plugin I use.

    See, from what I understand - this plugin will take x number of words from the post, but will it actually display the excerpt when I hit EDIT? That is to say, will it generate that excerpt to display only on a ost/page or will it be created within the admin area, within an editable post without outputing any actual code?

    If this is possible, it might work as the current plugin allows category specific excerpts, which is what I use - the only limitation it has is in only taking existing excerpts, rather than generating them automatically.

    So it would go something like:

    Orange Post <--permalink from c2c
    A post about oranges <--this would be the excerpt from c2c

    but the excerpt is auto generated behind the scenes by the reloaded plugin, so when c2c calls for an excerpt it takes the excerpt generated by the reloaded plugin. I know it's quite a complicated way to do things, but one plugin has x features, and another has x, and in this case my requirement is y:)

  6. RosieMBanks
    Member
    Posted 9 years ago #

    Jinsan, I'm not sure about what you're asking. Are you asking if the excerpt_reloaded plugin knows how to take the excerpt? Maybe I shouldn't post until I've had my morning cup of joe.

    When I used it, it successfully took the excerpt that I had entered into the Dashboard Write page and used it on the index, category and archive pages when I hit Publish. It stripped all the formatting, though. If my excerpt was 3 paragraphs long, they became one. Any bolding, italics, links, etc. were gone.

    Maybe posting without coffee is as bad as P.U.I., or Posting Under the Influence.

  7. Jinsan
    Member
    Posted 9 years ago #

    hmm

    well the_excerpt as it stands does one of two things:

    1) takes and existing excerpt
    2) creates an excerpt from existing content for a post but strips out the tags and html

    the plugin I use takes the excerpt that i have generated, but, I believe, does not auto generate the excerpt if there is none available.

    what i need is to display the excerpt, with formatting if it exists and auto generate as part of the content - so if I click to edit a post, there will an excerpt in the excerpt box that has been taking from the post content.

    the reason i need this is because it means i don't have to go through 200-300 and manually enter an excerpt for each. additionally, i need to include the formatting, and each entry will have an image preceeding or floating within the first few lines of content.

    in the end it may be a case that I have to do this myself. as a guideline, i would have no more than three sentences with a floated image either side of the text as the initial post. so if a plugin can extract those three lines, with the image and formatting, then that would be rather nice:)

  8. Lorelle
    Member
    Posted 9 years ago #

    Jinsan:
    I'm glad you understand that the_excerpt doesn't strip html if there is an explicity excerpt written. It only does so if there is no explicit excerpt. Like using the <!--more--> quicktag.

    Just so you understand, because I faced the exact same problem, if the_excerpt were to grab the first 120 words (default) of the post, it would grab an open <p> but not the closing one. And who knows where it might cut off, leaving more open tags unclosed. To get around breaking validation, the non-explicit excerpt strips the tags.

    When I want an image in the excerpt, I have it set up in an explicitly written excerpt with the graphic in place. This also allows me to customize the look of the excerpt.

    Where I don't have an image, and it is all text, I'm not worried and let that go. I have hundreds of posts to deal with, too, so I had to make choices and compromises.

    If you already have a graphic in the top section of your posts which the non-explicit excerpt will grab, you have to take into consideration the size of the graphic so it doesn't distort the design of your excerpt. I found that some images were tall and my text was too brief, so there was a lot of blank space compared to the height of the excerpt container. Finding the balance was a challenge.

    Dealing with the bugs in MSIE and a couple of other browsers, having the "excerpt" container featuring an image not be pushed over and around by the next post excerpt was a chore and I ended up having to use the clearfix fix from http://www.positioniseverything.net/ in order to get it to work.

    I hope that excerpt_reloaded or whatever plugin you find will overcome these challenges. I just went through and added photos and explicit excerpts to my most important past articles, and then work to fix it from here on out.

  9. RosieMBanks
    Member
    Posted 9 years ago #

    When I want an image in the excerpt, I have it set up in an explicitly written excerpt with the graphic in place. This also allows me to customize the look of the excerpt.

    Okay, Lorelle, you just cleared something up for me that I've been stuck on for a long time. I couldn't understand WHERE to put the formatting tags.

    If someone mentioned this before, it didn't get through. But Lorelle--she has the GIFT.

    I tried it and it works. I even wrote a div class for the excerpt so it will match the content. Now I've just got to fix all my excerpts. THANK you.

  10. Rhand
    Member
    Posted 8 years ago #

    I have an excerpt related question as well. I edited my theme index page. Now all category and archive posts show the excerpt instead of the content. But what I would like is to be able to click on the excertp or the [...] to see the whole story. How do I do that?

    Cheers,

    Jasper

  11. Rhand
    Member
    Posted 8 years ago #

    I have solved the issue. I am using the limit posts plugin. I just display everyting as content and limit the amount of characters with the pluging. The plugin also links to the complete post.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags