😂Excerpt full (ok)
https://wpshout.com/wordpress-post-excerpts/#gref
wp_trim_words
wp_trim_words(get_the_excerpt(), 15);Hoặc
public function excerpt( $new_length = 15, $echo, $more_text = 'more') {
if(!is_admin()):
add_filter( 'excerpt_more', $more_text, 999 );
add_filter( 'excerpt_length', $new_length, 999 );
endif;
if( $echo )
the_excerpt();
else
return get_the_excerpt();
}How to Change the Length of Your WordPress Excerpts with the excerpt_length Filter
excerpt_length Filterfunction wpshout_longer_excerpts( $length ) {
// Don't change anything inside /wp-admin/
if ( is_admin() ) {
return $length;
}
// Set excerpt length to 140 words
return 140;
}
// "999" priority makes this run last of all the functions hooked to this filter, meaning it overrides them
add_filter( 'excerpt_length', 'wpshout_longer_excerpts', 999 );How to Change the “Read More” Text of Your WordPress Excerpts with the excerpt_more Filter
excerpt_more FilterHow to Change the Text of a Post Excerpt with the get_the_excerpt Filter
get_the_excerpt FilterHow to Create One-Paragraph Excerpts with the wp_trim_excerpt Filter
wp_trim_excerpt FilterHow to Create Excerpts of a Specific Character Length (Rather than Word Length) with the wp_trim_excerpt Filter
wp_trim_excerpt FilterHow to Use wp_trim_words() to Get a WordPress Excerpt of Any Length from Arbitrary Text
wp_trim_words() to Get a WordPress Excerpt of Any Length from Arbitrary TextPreviousChanging search URL hocdekhangdinhminh.com (ok)NextGet Custom Taxonomy Field Value, acf, advanced custom fields (ok)
Last updated
Was this helpful?