1function wp_demo_shortcode() {
2
3//Turn on output buffering
4ob_start();
5$code = 'Hello World';
6ob_get_clean();
7
8 // Output needs to be return
9return $code;
10}
11
12// register shortcode
13add_shortcode('helloworld', 'wp_demo_shortcode');
1add_filter( 'widget_text', 'shortcode_unautop' );
2add_filter( 'widget_text', 'do_shortcode' );
3