add shortcode in short description

Solutions on MaxInterview for add shortcode in short description by the best coders in the world

showing results for - "add shortcode in short description"
Evan
21 Jul 2018
1<?php echo do_shortcode("[shortcode]"); ?>
Josué
03 Sep 2016
1remove_action( 'woocommerce_after_shop_loop_item', 'sp_loop_product_description', 6 );
2add_action( 'woocommerce_after_shop_loop_item', 'wp_11326339_custom_description', 6 );
3
4function wp_11326339_custom_description() {
5    global $product;
6
7    $wc_product = wc_get_product( $product );
8
9    if ( ! $wc_product ) {
10        return false;
11    }
12
13$short_description = $wc_product->get_short_description();
14
15    if ( '' !== $short_description ) {
16        echo '<div itemprop="description">' . do_shortcode( wpautop( wptexturize( $short_description ) ) ) . '</div>';
17    }    
18}