how to add shortcode in shortcode code example

Example 1: how to create shortcode

<?php
function abc()
{}
////create shortcode////
add_shortcode('page_name','abc');
?>

Example 2: add shortcode in short description

remove_action( 'woocommerce_after_shop_loop_item', 'sp_loop_product_description', 6 );
add_action( 'woocommerce_after_shop_loop_item', 'wp_11326339_custom_description', 6 );

function wp_11326339_custom_description() {
    global $product;

    $wc_product = wc_get_product( $product );

    if ( ! $wc_product ) {
        return false;
    }

$short_description = $wc_product->get_short_description();

    if ( '' !== $short_description ) {
        echo '<div itemprop="description">' . do_shortcode( wpautop( wptexturize( $short_description ) ) ) . '</div>';
    }    
}

Tags:

Php Example