• In normally when it generates a list of articles to put under “recent posts” or the RSS feed, WP just automatically cuts a blurb from the first X number of lines of text from each post made.

    The WP post editor has an optional excerpt field that allows the user to manually write an excerpt or summary when they feel the automatic clip from the article isn’t clear enough. Normally if users fill in the excerpt field, the text in that field is favored over the automatic pull quote when generating a list under “recent posts”

    What I want is a plugin that changes that behavior. What I want is a recent posts output that goes as follows:

    1. article one excerpt (A manual summary)
      Automatic pull quote of article one
    2. article two excerpt
      pull quote of article two
    3. article three excerpt
      pull quote of article three

    etc.

    I want both to be shown in the list. This would allow someone to, for example, write a quick summary of a scientific article have that shown along with WP’s automatic pull from the first X lines of the article (Usually a complex set of statements from an scientific abstract and not very accessible to nonexperts.)

    As the list is made I want both shown. Manual summary first, then the pull quote for each article.

    What plugin or tweak to the PHP would good to do that?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Moderator bcworkz

    (@bcworkz)

    Determine which theme templates need to have the output you describe. index.php and archive.php are likely candidates. Find where the template makes a call to the_excerpt() or your theme’s equivalent of it. You may need to locate a template part to find the call. Once found, add the following after the call:

    echo "<br><br>\n";
    echo wp_trim_excerpt();

    This will always output trimmed content, even when an explicit excerpt is defined.

    Thread Starter farlops

    (@farlops)

    Thanks BC,

    A question though, if I have a child-theme, will it be best to make the changes to index.php and archive.php there?

    Moderator bcworkz

    (@bcworkz)

    That’s right. The idea of child themes is to not need to change the parent at all. In fact, if your child has, say index.php, the parent index.php is never used, so there is no point in changing it 🙂

    Thread Starter farlops

    (@farlops)

    Hello again BC,

    I’ve discovered that my site’s parent theme (Called Salient) doesn’t have archive.php and it’s index.php makes no calls to _excerpt() or similar methods or functions at all.

    I guess I should contact that the developers of that theme to see how to do this?

    Moderator bcworkz

    (@bcworkz)

    That’s certainly worth a try. All you really need to know is exactly where to add my suggested code so the pull quote shows up where you want.

    I must say though, if your page is showing post excerpts, something is making a call to the_excerpt() or some similar code. Maybe it’s not recognizable to you (nothing wrong with that, not everyone can be PHP literate), but it’s there somewhere. So yes, asking someone more PHP literate who knows the theme is a great idea.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Recent Posts Plugin’ is closed to new replies.