• I using this

    [rpwe limit="10" cat="9" 
    post_type="post"
    post_status="publish"
    ignore_sticky="1" 
    link_target="true"
    post_title="true" 
    date="false"   
    thumb="true"
    thumb_height="240"  
    length="50"
    excerpt="true"  
    thumb_width="300" 
    thumb_default=""
    readmore="true"
    readmore_text="Detaljnije"]

    and it works great. But I need to format the excerpt.

    With this code below in my function.php I have HTML tags for every excerpt, but not for this plugin.

    // excerpt filter
    function custom_tptn_trim_excerpt( $text, $id ) {
    	$raw_excerpt = $text; 
        
    	$text = get_the_content( null, false, $id );
    
    	$text = strip_shortcodes( $text );
    
    	$text = apply_filters( 'the_content', $text );
    	$text = str_replace( ']]>', ']]>', $text );
    
    	/***Add the allowed HTML tags separated by a comma.*/
    	$allowed_tags = '<br>,<p>,<i>';
    	$text         = strip_tags( $text, $allowed_tags );
    
    	/***Change the excerpt word count.*/
    	$excerpt_length = 60;
    	$excerpt_length = apply_filters( 'excerpt_length', $excerpt_length );
    
    	/*** Change the excerpt ending.*/
    	$excerpt_end  = ' <a href="' . get_permalink( $id ) . '">&raquo; Continue Reading.</a>';
    	$excerpt_more = apply_filters( 'excerpt_more', ' ' . $excerpt_end );
    
    	$words = preg_split( "/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY );
    	if ( count( $words ) > $excerpt_length ) {
    		array_pop( $words );
    		$text = implode( ' ', $words );
    		$text = $text . $excerpt_more;
    	}
    	return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt ); 
    }
    add_filter( 'tptn_excerpt', 'custom_tptn_trim_excerpt', 10, 2 );

    Can I put some filters here or have anybody idea how can I allow these HTML tags for excerpts with this plugin?

    Thanks a lot for your time

  • The topic ‘How can I allow a few HTML tags to excerpt?’ is closed to new replies.