skip to Main Content

Custom Excerpt Output

The following snippet will allow you to alter the custom output for any excerpts used in the theme. By default the heme will try and locate the first paragraph of text on the site and create the excerpt from it (unless a custom excerpt has been defined for the post/page). By hooking into the 'wpex_excerpt_args' filter and altering the 'custom_output' argument it will bypass any theme checks and only process your custom output making it very efficient.

function my_custom_excerpt_output( $args ) {
    $args['custom_output'] = get_the_excerpt(); // Change get_the_excerpt() function to whatever you want the output to be
    return $args;
add_filter( 'wpex_excerpt_args',  'my_custom_excerpt_output' );
All PHP snippets should be added via child theme's functions.php file or via a plugin (we recommend Code Snippets)
Back To Top