A
A
AltaiR2016-09-01 11:40:04
PHP
AltaiR, 2016-09-01 11:40:04

How to add a class to product short description in WooCommerce catalog?

I am pulling the first layout on wordpress . I don't know PHP . Following instructions from the Internet, I concluded a brief description of the WooCommerce product in the catalog:

function add_short_description() {
  echo the_excerpt();
}

add_action( 'woocommerce_after_shop_loop_item_title', 'add_short_description', 9 );

He brought it out simply in the tag <p>...</p>. And how to make it so that you can add your own class to this paragraph? Thanks

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Denis Yanchevsky, 2016-09-01
@deniscopro

Can be wrapped in a div

function add_short_description() {
  echo '<div class="my-class">';
  echo the_excerpt();
  echo '</div>';
}

add_action( 'woocommerce_after_shop_loop_item_title', 'add_short_description', 9 );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question