WordPress.org

Ready to get started?Download WordPress

Forums

Excerpts (7 posts)

  1. NuclearMoose
    Member
    Posted 10 years ago #

    Apologies if this has been asked or suggested before--is there a way to add the functionality to have excerpts created, say, by setting a variable up in WP to automagically use the first x number of words in a post as the excerpt?
    Hmm...perhaps there is a hack for this? It would sure speed up the posting process. Also, I just want to be sure of something; is the excerpt basically for RSS feeds, or can it be used on a site where only the excerpt is shown and the whole post will only show when a reader selects the excerpt?
    Thanks, all!

  2. Cena
    Member
    Posted 10 years ago #

    My (faulty, I'm sure) understanding of the_excerpt is that it's used for RSS specifically.
    If in the second part of that last question you're using 'excerpt' to mean essentially a 'teaser', this from the readme:
    " For example <?php the_content("read more","0","blah.php") ?> would display a link to blah.php, with the link text read more, and won't display the teaser message.
    To enter an extended entry, just type <!--more--> in your entry. The part before that comment is the teaser, the part after it is the extended entry. To force the extended entry not to show the teaser message, type <!--noteaser--> somewhere in your entry.
    To enter an entry with several pages, just type <!--nextpage--> in your entry to start a new page."

  3. NuclearMoose
    Member
    Posted 10 years ago #

    Thanks, Cena.
    Coincidentally, I was just writing a post and noticed that "Excerpt" was hyperlinked. I never realised that initially, so I guess I should mess around with the CSS for the GUI so that noobs like me can see this stuff! :)
    Anyway, I found out that if I don't write an excerpt, then WP will do it for me. Also, there is a way of putting in a teaser, like you mention, to force the reader to click on articles of interest to get at the body of the post. This is good and bad, I suppose. Depends on the quality of your titles to attract readers, I guess. Not sure how Search Engines would handle that either.
    Dang, there's so much to learn. I gotta spend the weekend reading through more of the WP stuff. It's so cool to learn something new every day!
    Craig.

  4. prara
    Member
    Posted 10 years ago #

    I think there is no option for setting the number of words that contain the excerpt. But you can hack the the_excerpt function at wp-includes/templates-function-post.php. Default setting is 120 I think.

  5. Anonymous
    Unregistered
    Posted 9 years ago #

    For what it's woth, the code on this page also worked for me. I spent a bunch of time searching the Support archives and looking through the Wiki and so forth, and much of it was confusing, especially references to the <more> tag, which I could never figure out. Anyhow, the code replacement suggested above seems to work.
    Thanks,

  6. Jack
    Member
    Posted 9 years ago #

    I don't know if this fits in this thread, but in a site I made I couldn't get the teaser/more etc. thing working (and that hasn't changed), but I somehow solved it by inserting this code:
    <?php
    if($p){
    the_content();
    } else {
    the_excerpt();
    }
    ?>

    So in the case of a page with posts the excerpt is shown first, and clicking on the link the full post. If no excerpt present the full content is shown right from the beginning.
    But I still don't understand why the 'more' tag isn't working...

  7. Anonymous
    Unregistered
    Posted 9 years ago #

    Just to note, there is a 'condensed content plugin' (http://manalang.com/archives/2004/06/20/wordpress-plugin-condensed-content-for-date-and-category-archives) that will let you set how many words to show and then link to the rest. Works on the search and archives pages, and it was easy to tweek to work on the index page as well. Note- it does strip all tags, which is sort of necessary, but can be ugly.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.