Web Hosting
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

WordPress fix Reply To: Related posts showing too much excerpt

Discussion in 'Misc WordPress Requests' started by dineshkashera, Oct 21, 2017.

  1. dineshkashera

    Guest

    Reply To: Related posts showing too much excerpt, by dineshkashera

    Hello,

    You can limit the excerpt length on post by below code.Please Paste the below code in your current theme’s functions.php file.

    function custom_excerpt_length( $length ) {
    global $post;
    $post_id = $post->ID;

    if ( get_post_type( $post_id ) == 'post') {
    return 20;
    }
    return 30;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    Thanks

    Reply To: Related posts showing too much excerpt
     
    #1

Share This Page

Web Hosting