use php in shortcode
hi
i make a shortcode and is working very good
but my problem is i can just use
function short1( $atts , $content = null ) {
return ”.$content.”;
}
add_shortcode( ‘shor1’, ‘short1’ );
how can i add php to shorcode replace with div class red
is my false way!!!
function short1( $atts , $content = null ) {
return ‘ ‘product’,’posts_per_page’=>’6′ ) ); ?>
have_posts() ) : ?>
have_posts() ) : $the_query->the_post(); ?>
“>
“>
get_price_html(); ?>
add_to_cart_url(); ?>” class=”add-to-cart”>
‘.$content.”;
}
add_shortcode( ‘shor1’, ‘short1’ );
Leave an answer