Skip to content

Snippet: Enable Support for the WordPress “More” Break

The Total theme has a custom excerpt function which bypasses the WordPress excerpt so that you can define how many words you want to display for your excerpts. The theme's excerpt function by default ignores the "read more" break so that you can have different post lengths across your site without worrying about the read more break causing issues. For example, maybe you want excerpts for your related items to be shorter then excerpts for your archives.

The snippet below will enable support for the read more break in the theme's custom excerpt function globally.

/**
 * Enable Support for the WordPress "Read More" Break.
 *
 * @link https://total.wpexplorer.com/docs/snippets/read-more-tag-button/
 */
add_filter( 'wpex_excerpt_args', function( $args ) {
    if ( false !== strpos( get_the_content(), 'more-link' ) ) {
        $args['length'] = '9999';
    }
    return $args;
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top