Add $more_link_text parameter to the_excerpt()

You can use get_post_type add_filter(‘excerpt_more’, ‘new_excerpt_more’); function new_excerpt_more($more) { global $post; $post_type = get_post_type($post); switch( $post_type ): case ‘event’: $teaser=”<a class=”moretag” href=””. get_permalink($post->ID) . ‘”> More events </a>’; break; case ‘post’: $teaser=”<a class=”moretag” href=””. get_permalink($post->ID) . ‘”> &hellip; </a>’; break; default $teaser=””; endswitch; return $teaser; }

make a excerpt on data from a meta box?

You could make use of wp_trim_words: <p><?php echo wp_trim_words( get_post_meta( $post->ID, ‘twpb_news_textnews’, true ), 55, ‘[&hellip;]’ ); ?></p> Or, if you want the filters applicable to the regular excerpts to be used as well, write your own wrapper for it: function wpse115106_news_excerpt( $text=”” ) { $excerpt_length = apply_filters( ‘excerpt_length’, 55 ); $excerpt_more = apply_filters( ‘excerpt_more’, … Read more

Read more on the post page itself

The solution might depend on why exactly you want it to work that way on the post page. But probably the best way would be to do this on the client side. Method with maximum height Let’s say your post template has its content like this: <div id=”content”><?php the_content(); ?></div> You need to add a … Read more

Twenty Fourteen: Change Read More text

In the twenty fourteen theme there is a plugable function named twentyfourteen_excerpt_more which generates the read more links. This function can be overridden in your child theme to use your custom read more link. All you need to do is add the following to your child theme’s functions.php file: /** * Overrides the parent function … Read more

Read More for Excerpt not working

You can modify the […] with simple function you place in functions.php function wpdocs_excerpt_more( $more ) { return ‘<a href=”‘.get_permalink( get_the_ID() ).'”>[…]</a>’; } add_filter( ‘excerpt_more’, ‘wpdocs_excerpt_more’ );

Custom excerpt legnths for specific pages

The excerpt length is the number of words, not the characters. Assuming that every word is 8 characters long in average, you might want to use this: function wpdocs_custom_excerpt_length( $length ) { if( is_front_page() ){ return 50; } else { return 100; } } add_filter( ‘excerpt_length’, ‘wpdocs_custom_excerpt_length’, 999 ); Source : WordPress codex

Remove ellipsis from the excerpt retrieved using get_the_excerpt()

The third field in add_filter() is priority. Default WP hook priority is 10. You can omit the 1 altogether, or still declare number of arguments accepting by function by passing it as 4th field. add_filter(‘excerpt_more’, ‘change_excerpt_more’, 10, 1); OR for default: add_filter(‘excerpt_more’, ‘change_excerpt_more’); re: questions in comments still wondering why it wouldn’t work without having … Read more

How to display only the excerpt in the blog/posts page with Gutenberg?

You should use a custom page for this. For reference, we can modify the default (twentynineteen) post content block. Depending on your theme, you may need to modify single.php, or a content block included from there. In the twentynineteen theme, we can see this on line 24: get_template_part( ‘template-parts/content/content’, ‘single’ ); Following that, we can … Read more