If you forget to add a short description to your product, this code will automatically put in a generic text so that you aren’t left with an embarrassing blank entry.
/**
* Show default short description if empty
*/
add_action('woocommerce_single_product_summary', 'cc_short_description_if_empty', 21);
function cc_short_description_if_empty() {
global $post;
if (empty ($post->post_excerpt) ) {
$post_excerpt = '<p class="default-short-desc">';
$post_excerpt .= 'This is the default, global, short description.<br>It will show if <b>no short description has been entered!</b>';
$post_excerpt .= '</p>';
echo $post_excerpt;
}
}
View Raw
Code ID: 91099