WordPress.org

Ready to get started?Download WordPress

Forums

Advanced Excerpt
Append "Read More" to Custom Excerpt (6 posts)

  1. jodamo5
    Member
    Posted 2 years ago #

    The Advanced Excerpt plugin is great, but there's one extra setting I'd love.

    In the settings there is the option "No custom excerpts" option.
    I *DO* want to be able to use custom excerpts at times, so haven't ticked this option. But the problem is, I then get an excerpt appear that doesn't have a "read more..." link at the end.

    So I'd love to see one more option added to the settings:
    "Append 'Read More' text to Custom Excerpts"

    So if there is an custom excerpt written, the plugin would use that excerpt, but still add the Read More link to the end.

    Would this be possible?

    http://wordpress.org/extend/plugins/advanced-excerpt/

  2. photocurio
    Member
    Posted 2 years ago #

    +1

  3. photocurio
    Member
    Posted 2 years ago #

    I solved my problem by unchecking the Read More button in the Advanced Excerpt panel, and inserting read more links with a custom function. See section headed "How to add a link beneath an excerpt to the full post". That adds read more links to every time the_excerpt is called.

  4. jodamo5
    Member
    Posted 2 years ago #

    Hi Photocurio. Thanks so much for that link.

    I put that code in, but I don't link how it puts the "read more" link on a new line underneath the excerpt. I really wanted it to be tagged on the end like the other "read more" tags.

    And after much messing around, I've finally worked it out. So I'll post it here in case others want to find the solution too.

    In the advanced-excerpt.php file (inside the advanced excerpt plugin folder) find this code:


    // Avoid custom excerpts
    if (!empty($text) && !$no_custom)
    return $text;

    and replace it with this:

    // Avoid custom excerpts (but still add read more)
    if (!empty($text) && !$no_custom)
    { $text = $this->text_add_more($text, $ellipsis, ($add_link) ? $read_more : false);
    return $text;}

    What this does is tell Advanced Excerpt to still add the same "Read More" tag that you use for all other excerpts, even when a custom excerpt is used.

    If there are any updates released for this plugin, you'll just need to copy this code back in.

  5. jdom
    Member
    Posted 1 year ago #

    Awesome job, howeverI have a 70 word limit on generated excepts and it threw the read more link in after 70 words but left the rest of the custom excerpt. And instead of me counting 70 words every time I put a custom excerpt in is there a way to just append it at the end of the custom version?

  6. photocurio
    Member
    Posted 1 year ago #

    @Jodamo, Generally I don't like to hack up a well written plugin, but this one looks like the developer has stopped work on it. So why not? Be sure to rename the plugin and the folder it's in, or, if the developer does release an update, it could erase your changes.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic