Filter everything from content except output of a shortcode

function shortcode_only_wpse_96114($content) { $regex = get_shortcode_regex(); preg_match_all(“https://wordpress.stackexchange.com/”.$regex.”https://wordpress.stackexchange.com/”,$content,$matches); if (!empty($matches[0])) { $content = do_shortcode(implode(‘ ‘,$matches[0])); } return $content; } add_filter(‘the_content’,’shortcode_only_wpse_96114′,1); That should check for any registered shortcodes and if present completely replace the post content with the output of the shortcode(s), removing any other content. If no shortcodes are found the post content gets returned as … Read more

Could use some help with Shortcodes

First of all… It’s a really poor quality code, I guess. You assume that there will be only one tabs widget on page (it’s recognized by HTML id param, so placing 2 widgets on same page would generate invalid HTML code). You also implement only one shortcode, which parses it’s content. But I don’t think … Read more

Displaying audio player as preview in audio post in WP3.6

You missed the src part. It should have been: Go on the Shortcode section of the Audio / Video support in Core post. $post_content=”lorem ipsum dolor lorem ipsum “; if( preg_match( ‘#\#s’, $post_content, $matches ) && preg_match(“https://wordpress.stackexchange.com/”([^”]+)”https://wordpress.stackexchange.com/”, $matches[0], $m) ){ echo $m[1]; // echoes http://wpthemetestdata.files.wordpress.com/2008/06/originaldixielandjazzbandwithalbernard-stlouisblues.mp3 //set as featured } The first regex will get your … Read more