Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add the product description below the product, see: https://wordpress.org/support/topic/short-description-below-product. This is the updated code, using `get_the_excerpt()`
<?php
/**
* Add the product description (the excerpt of the cpt) below the product.
*
* @author Joshua David Nelson, josh@joshuadnelson.com
* @link https://wordpress.org/support/topic/short-description-below-product
*/
add_action( 'woocommerce_after_shop_loop_item_title', 'jdn_add_short_description', 9 );
function jdn_add_short_description() {
// Description linked to product
$url = get_the_permalink();
if( $url ) {
echo '<span class="title-description"><a href="' . $url . '">' . get_the_excerpt() . '</a></span><br />';
} else {
echo '<span class="title-description">' . get_the_excerpt() . '</span><br />';
}
}
@swdtrista

This comment has been minimized.

Copy link

commented Jun 16, 2017

Hi,

I added this into my function.php file of our child theme to have the description under the price in the listings page. It worked great, however then by boss decided she didn't really want this function and I deleted the code and saved the file. Since then I am seeing half of the description, I can't hide it with css or figure out how to get rid of it. Any help would be great, thanks so much!
https://www.sidewalkdog.com/product-category/patio-leash/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.