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

Schema theme, how to edit excerpt length?

Discussion in 'Blogging' started by Imma_Noob, Feb 11, 2016.

  1. Imma_Noob

    Imma_Noob Junior Member

    Joined:
    Jun 1, 2012
    Messages:
    155
    Likes Received:
    23
    Location:
    ebay
    I want to make the page display the entire post and not just an excerpt.
    test_post.png


    I think something in the functions.php file needs changed but I'm not sure what.

    Code:
    // Remove [...] and shortcodes
    function mts_custom_excerpt( $output ) {
      return preg_replace( '/\[[^\]]*]/', '', $output );
    }
    add_filter( 'get_the_excerpt', 'mts_custom_excerpt' );
    
    // Truncate string to x letters/words
    function mts_truncate( $str, $length = 40, $units = 'letters', $ellipsis = ' …' ) {
        if ( $units == 'letters' ) {
            if ( mb_strlen( $str ) > $length ) {
                return mb_substr( $str, 0, $length ) . $ellipsis;
            } else {
                return $str;
            }
        } else {
            $words = explode( ' ', $str );
            if ( count( $words ) > $length ) {
                return implode( " ", array_slice( $words, 0, $length ) ) . $ellipsis;
            } else {
                return $str;
            }
        }
    }
    
    if ( ! function_exists( 'mts_excerpt' ) ) {
        function mts_excerpt( $limit = 40 ) {
          return mts_truncate( get_the_excerpt(), $limit, 'words' );
        }
    }
    I tried changing the 40 to 500 but it didn't change anything.
     
  2. Imma_Noob

    Imma_Noob Junior Member

    Joined:
    Jun 1, 2012
    Messages:
    155
    Likes Received:
    23
    Location:
    ebay
    I discovered it's in archive.php. So I guess my real problem is when I click on a category, it's going straight to archive. So if my category is Widgets, and my post is made to the category Widgets, it pulls up Widgets Archived, then I have to click on "continue reading" to read the entire post.