Advertisement
arie_cristianD

override post excerpt length with substr

Apr 7th, 2025
323
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.39 KB | None | 0 0
  1. add_filter( 'jnews_module_excerpt', 'override_jnews_module_excerpt', 99, 4 );
  2.  
  3. function override_jnews_module_excerpt( $excerpt, $post_id, $excerpt_length, $excerpt_more ) {
  4.  
  5.     $excerpt  = mb_substr( $excerpt, 0, 100, 'UTF-8' ); /* You can replace the value 100 with the number of characters you want to display in the post excerpt. */
  6.     $excerpt .= ' ' . $excerpt_more;
  7.  
  8.     return $excerpt;
  9. }
  10.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement