Woocommerce excerpts CSS affect rest of the page

I added this PHP function to display the excerpt of my products on the archive pages, however it affects the rest of my styling.

I’m trying to stop the CSS from my excerpts to affect the rest of the page. Basically I would like only the text without its own styling or bullets, or images, etc.

Read More

This is the code added :

<?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); ?>

Related posts

1 comment

  1. add some html to your excerpt.. to target only that certain html…
    example, adding a div with a class my-excerpt:

    <div class="my-excerpt">
    <?php echo apply_filters( 'woocommerce_short_description', $post->post_excerpt ); ?>
    </div>
    

    your css would then be:

    .my-excerpt img {
       border: 0;
    }
    

Comments are closed.