Support » Plugin: Advanced Excerpt » [Plugin: Advanced Excerpt] Plugin breaks HTML in some cases

  • Hello,

    I want to preserve anchors in the_excerpt, so I’m testing this plugin. This is how excerpt generated with this plugin ends in one of the cases:

    <p>2008: <a&hellip;</p>

    So the anchor is interrupted in the middle of the opening tag. Is there any way how to fix that?

    Here’s a couple of test regexes I came up with:

    add_filter( 'the_excerpt', 'fv_customize_the_excerpt' );
    function fv_customize_the_excerpt( $excerpt ) {
      $excerpt = preg_replace( '/<[^>p]*?>[^>]*?<\/p>$/i', '&hellip;</p>', $excerpt );
      $excerpt = preg_replace( '/<[^\/][^>]*?<\/p>$/i', '&hellip;</p>', $excerpt );
      return $excerpt;
    }

    The first one makes sure that before the final closing P tag there is no other tag without closing tag (so it won’t work with images for example).

    The second one checks for a broken opening tag.

    I’m sure this is not enough and sooner or later there will be some issue with this.

    Will this be fixed in one of the next versions?

    Thanks,
    Martin

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

  • The topic ‘[Plugin: Advanced Excerpt] Plugin breaks HTML in some cases’ is closed to new replies.