function your_shortcode() { ob_start(); ?> <!-- shortcode data here --> <?php $output = ob_get_contents(); ob_end_clean(); return $output; } add_shortcode( 'shortcode','your_shortcode' );