I want to show product short description in product boxes. I am using this,
<?php if ( $description_words_limit > 0 ) { ?>
<div class="atgrid__item__description">
<?php echo adventure_tours_get_short_description( $item->post ); ?>
</div>
<?php } ?>
The function:
if ( ! function_exists( 'adventure_tours_get_short_description' ) ) {
/**
* Returns short description for current post or for the specefied post.
*
* @param WP_Post $forPost optional post object (if empty - current post will be used).
* @param int $word_limit max allowed words count.
* @return string
*/
function adventure_tours_get_short_description( $forPost = null, $word_limit = null ) {
$resetPost = ! empty( $forPost );
if ( null === $forPost ) {
$forPost = get_post();
}
if ( ! $forPost ) {
return '';
}
$text = $forPost->post_excerpt ? $forPost->post_excerpt : $forPost->post_content;
if ( $text ) {
return adventure_tours_do_excerpt( $text, $word_limit );
} else {
return $text;
}
}
}
This code prints short description text, but I want complete html.
How can I do this?
Thanks for any help