WordPress.org

Forums

Advanced Excerpt
[resolved] Allow "Insert Read More Tag" button to override everything (5 posts)

  1. officeninjas
    Member
    Posted 1 year ago #

    I wanted to give contributors flexibility to add a "read more" link using the "Insert Read More Tag" button anywhere they want and have it override advanced excerpt.

    If this is what you want and are using the latest version 4.2.3 edit file advanced-excerpt.php under the class folder and make the following 3 changes:

    1) Change line 226

    Before

    if ( $the_content_no_break && false !== strpos( $post->post_content, '<!--more-->' ) && 'content' == $this->filter_type ) {

    After

    $has_more_tag = (false !== strpos( $post->post_content, '<!--more-->' ));
    if ( $the_content_no_break && $has_more_tag && 'content' == $this->filter_type ) {

    2) Change line 277

    Before

    $text = $this->text_excerpt( $text, $length, $length_type, $finish );

    After

    if (!$has_more_tag)
    $text = $this->text_excerpt( $text, $length, $length_type, $finish );

    3) Change line 280

    Before

    if ( !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {

    After

    if ( $has_more_tag || !apply_filters( 'advanced_excerpt_disable_add_more', false, $text_before_trimming, $this->options ) ) {

    https://wordpress.org/plugins/advanced-excerpt/

  2. Chris Aprea
    Member
    Plugin Author

    Posted 1 year ago #

    Feel free to open a pull request if you'd like: https://github.com/deliciousbrains/wp-advanced-excerpt

  3. officeninjas
    Member
    Posted 1 year ago #

    Will do ... first, I'll add an enable option in case someone doesn't want this behavior.

  4. jf80
    Member
    Posted 1 year ago #

    Did this make it to the live version?

    Thanks.

  5. toroman
    Member
    Posted 1 year ago #

    im agree too, this function must include in next update

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Advanced Excerpt
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic