How to remove “Read on” content in the_excerpt?

If you’re using the Twenty Eleven theme I think you need to remove that theme’s filter before you can define your own: remove_filter( ‘excerpt_more’, ‘twentyeleven_auto_excerpt_more’ ); edit building from t-p try this: add_action( ‘after_setup_theme’, ‘my_child_theme_setup’ ); function my_child_theme_setup() { remove_filter( ‘excerpt_more’, ‘twentyten_auto_excerpt_more’ ); } In case you are using twentyeleven, use “twentyeleven_auto_excerpt_more” instead of ‘twentyten_auto_excerpt_more’

get_the_excerpt() with fallback like the_excerpt()

The function the_excerpt() is only a echo of the function get_the_excerpt(): function the_excerpt() { echo apply_filters(‘the_excerpt’, get_the_excerpt()); } If you like a fall back for no input the excerpt meta box, then create a text from the content – get_the_content(). You can use the core function wp_trim_words() for set the counter for words and easy … Read more

Replace the Post Excerpt Meta Box with a Field in My Custom Meta Box

Just name the field ‘excerpt’. E.g.: <textarea name=”excerpt” id=”excerpt”><?php echo esc_html( ‘$post->post_excerpt’ ); ?></textarea> <!– if it is a textarea field –> or <input name=”excerpt” id=”excerpt” value=”<?php echo esc_attr( ‘$post->post_excerpt’ ); ?>” /> <!– if it is a text field –>

display public excerpt for private post

I’ve not tested this, but you should be able to complete this task by placing the following code in your template above the loop. query_posts( array( ‘post_status’ => array( ‘published’, ‘private’ ) ) ); This should allow for published and private posts to be displayed in that template.

How do I disable excerpts on blogs and website

You need to call remove_post_type_support() in your functions.php like that: /** * Remove unwanted features. */ add_action(‘init’, ‘my_theme_remove_post_type_support’); function my_theme_remove_post_type_support() { remove_post_type_support(‘post’, ‘excerpt’); }

Limit the_excerpt with max of x characters

add_filter(‘wp_trim_excerpt’, function($text){ $max_length = 140; if(mb_strlen($text, ‘UTF-8’) > $max_length){ $split_pos = mb_strpos(wordwrap($text, $max_length), “\n”, 0, ‘UTF-8’); $text = mb_substr($text, 0, $split_pos, ‘UTF-8′); } return $text; }); This should take into account your max length and split the text at the nearest word boundary. Apply the filter, and call the_excerpt(); in your templates Apparently there’s a … Read more

“Read more” link doesn’t show up when the post length is under the excerpt length

The reason is the following check in the wp_trim_words() function: if ( count( $words_array ) > $num_words ) { array_pop( $words_array ); $text = implode( $sep, $words_array ); $text = $text . $more; } else { $text = implode( $sep, $words_array ); } You can therefore try the following: add_filter( ‘wp_trim_words’, function( $text, $num_words, $more … Read more

Remove images from get_the_excerpt

If you read the Codex entry for get_the_excerpt(), you will find this: If the post does not have an excerpt, this function applies wp_trim_excerpt to the post content and returns that generated string with “[…]” at the end. wp_trim_excerpt is applied via the get_the_excerpt filter and can be removed. The wp_trim_excerpt() function: Generates an excerpt … Read more