Slideshare shortcode for wordpress 3.5


If you upgraded your WP installation to 3.5 and you had the SlideShare for WordPress by Yoast plugin to use shortcode , now you are in a dead end.
The plugin  breaks 3.5’s Slideshare own embed function but if you unistall it you simple get
[‘slideshare id=10400276&doc=ancientgreecejeopardy-111130094646-phpapp02’] in to your posts already made.

There are two solutions:


add_shortcode( 'slideshare', 'my_slideshare_shortcode' );

function my_slideshare_shortcode( $atts ) {

// We need to use the WP_Embed class instance
global $wp_embed;

// The "id" parameter is required
if ( empty($atts['id']) )
return '';

// Construct the YouTube URL
$url = 'http://www.slideshare.net/slideshow/embed_code/' . $atts['id'];

// Run the URL through the handler.
// This handler handles calling the oEmbed class
// and more importantly will also do the caching!
return $wp_embed->shortcode( $atts, $url );
}