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()`
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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 />'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/