Support » Fixing WordPress » Excerpts with different lengths

  • Goodmorning everybody.

    One of the parts of my WP site contains articles. I cannot make it exactly the way I want, but I just thought of something that I haven’t been able to make yet. I have a static index, because I don’t want 20 articles to be on the index. When I set to display but one article per page, this also goes for the archives and that’s not really a sollution either. So, I in my archive.php I use the the_excerpt command, so when using the archive, people just get a maximum of 20 exerpts per page, very nice. Now I figured, can I make the index.php thus, that the first excerpt (the newest article) cuts off at, let’s say, 60 words and every other at 30 words? Preferable automatically of course, so that when I post a new article, the article that has now become the second one, immediately goes to a 30-word-excerpt. Is it possible to make a the_excerpt that only displays the last article and the_excerpts to show the rest AND with different lengths??

    Thanks in advance for your suggestions.

Viewing 5 replies - 1 through 5 (of 5 total)
  • However Moshu suggested the_excerpt_reloaded for this, I can’t work it out. This plugin needs a coded length for an excerpt, but can I put two codes in one loop and how it only the latest post going to be different from the rest…? I don’t really see the difference with the standard get_excerpt except that you can add some variables (but not the one I want?).

    My suggestion is still valid – you just need to add a post count and a conditional. There are many code snippets posted for post count, if you search for latest post different style and similar keywords.

    Basically, you will have a custom Loop where if it is the latest post
    excerpt_reloaded 60 words
    excerpt_reloaded 30 words

    Right, I’ll give it a go. Thanks.

    No luck whatsoever. I can’t get the_excerpt_reloaded to work properly. I have no clue what to put where. I now have the following in my index.php:

    <div class="postentry">
    <?php the_excerpt(__('Continue reading'). " ‘" . the_title('', '', false) . "’ &raquo;"); ?>

    This works, but ends the excerpt with an ugly [...] (where does WP find that anyway?). I have tried the Advanced Excerpt and Evermore plugins, but for some reason they don’t do their job on the index (archives work just fine). Then I tried to put the “more” tag in each article, but this one leaves every code intact and is there for unworkable (excerpts have too large images, parts of tables, etc.). So I went back to the_excerpt_reloaded… I have changed the code above with <php the_excerpt_reloaded(55, '<blockquote>', '>> Continue reading >>'); ?> (in a few variations, even including a completely ’empty’ the_excerpt reloaded tag), but it messes up the entire index.php. Categories move above the title, date below the ‘excerpt’, there is no excerpt whatsover (just the word “more” without a link). I obviously do something wrong, but I don’t know what. I haven’t found clearer unstructions than on the plugin page, so I just ask here. Naturally I also didn’t get to Moshu’s suggestion for different excerpts length (I can’t even make the basis…).

    Ok, the Excerpt Editor does work on my index as well. I even managed to add some variables (allow <blockquote> tag). Maybe in this one I can manage to have different excerpt lengths.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Excerpts with different lengths’ is closed to new replies.