Viewing 4 replies - 1 through 4 (of 4 total)
  • Looks like you’re using WooCommerce. Assuming your theme hasn’t removed any hooks from its templates, this should work:

    add_action( 'woocommerce_after_shop_loop_item', 'the_excerpt', 7 );

    Add that to your theme’s functions.php file. Although to avoid issues with theme updates, you should consider creating a Child Theme and utting the code in its functions.php file. Here’s some info on Child Themes:
    https://codex.www.ads-software.com/Child_Themes

    Thread Starter pierremichaux

    (@pierremichaux)

    Hi,
    Great…it works!
    I have a child theme that I configured already. Thx.

    Only thing now…how to setup the excerpt length? I was thinking 2 lines max.

    Thank you,
    Pierre

    You can adjust the length of excerpts like so:

    function regence_excerpt_length( $length ) {
    	return 20;
    }
    add_filter( 'excerpt_length', 'regence_excerpt_length', 999 );

    Where 20 is the number of words that will show. Getting exactly two lines will be tricky though, especially since your site’s responsive. You cold do it with some CSS, like:

    .products .product p {
        max-height: 3.7em;
        overflow: hidden;
        box-sizing: border-box;
    }

    (Your line height is 1.85em. So 3.7em is 2 lines.);

    Thread Starter pierremichaux

    (@pierremichaux)

    I am keeping the css option because when I added the .php lines in my functions file, it crashed the website with http500 error…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Excerpt short description’ is closed to new replies.