How to change the length of excerpts in Oxygen Builder

Install and activate the Code Snippets plugin.

Add a below Snippet. Give a title of say “Excerpt length” and paste in the code. Select “Only run on site front-end”. Then save the changes and activate.

add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );
/**
 * Change the length of excerpt.
 *
 * @param int $length The number of words. Default 55.
 * @return int New excerpt length.
 */
function custom_excerpt_length( $length ) {

    return 20; // number of words. Default is 55.

}

To remove [...], paste below snippet.

function new_excerpt_more( $more ) {
    return '...';
}
add_filter('excerpt_more', 'new_excerpt_more');

You can put together both the snippet in one file OR separate. Both will work.

Copyright © 2024 Siam Naulak.
magnifiercrossmenu