Posts

Showing posts with the label remove_filter

How to allow html tags in the_excerpt post function in wordpress

Just copy and paste below code into your theme's functions.php file or in your custom plugin file. and change according to your need. function rj_wp_trim_excerpt($text) { $raw_excerpt = $text; if ( '' == $text ) {     $text = get_the_content('');     $text = strip_shortcodes( $text );     $text = apply_filters('the_content', $text);     $text = str_replace(']]>', ']]&gt;', $text);          $allowed_tags = '<p>,<a>'; // write your tags here for allow them in excerpt with comma seprated     $text = strip_tags($text, $allowed_tags);          $excerpt_word_count = 55; // change length of excerpt according to your need     $excerpt_length = apply_filters('excerpt_length', $excerpt_word_count);          $excerpt_end = '[...]';     $excerpt_more = apply_filters('ex...