Skip to content

Snippet: Add a Simple More Link to Testimonial Cards

By default the pre-build testimonial card styles don't include read more buttons because for the most part testimonials should display in full on the page (no one wants to click to go read a testimonial on it's own page - especially not for multiple testimonials) however, if you really want to add a more link without creating a custom card you can do so using a little code (see below).

After adding the code to your site be sure to enter a custom excerpt length for your testimonials, otherwise it will keep showing the full post content.

add_filter( 'wpex_card_excerpt_args', function( $args, $card ) {
    if ( str_starts_with( $card->style, 'testimonial_' ) ) {
        $args['more'] = '…<a href="' . esc_url( $card->get_var( 'url' ) ) . '">read more →</a>';
    }
    return $args;
}, 10, 2 );
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