Shortcode pour Youtube :
La syntaxe dans l’article est:[youtube id=ddPTXNRFAlQ ], id correspond à l’id de la vidéo à afficher.
Le lien de la vidéo se trouve ici (en gras): exemple http://www.youtube.com/watch?v=ddPTXNRFAlQ&feature=feedrec_grec_index
function shortcode_youtube( $atts, $content= null ) { extract( shortcode_atts( array( 'id' => '', 'height' => 350, 'width' => 640, ), $atts ) ); $out = '<div id="youtube"><object width="'.$width.'" height="'.$height.'"> <param name="movie" value="http://www.youtube.com/v/'.$id.'?version=3&hl=fr_FR&rel=0"></param> <param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param> <embed src="http://www.youtube.com/v/'.$id.'?version=3&hl=fr_FR&rel=0" type="application/x-shockwave-flash" width="420" height="315" allowscriptaccess="always" allowfullscreen="true"></embed> </object></div>'; return $out; } add_shortcode( 'youtube', 'shortcode_youtube' );
Shortcode pour Vimeo :
La syntaxe dans l’article est: [vimeo id=lien_de_la_video]
Le lien de la vidéo se trouve ici (en gras): exemple http://vimeo.com/32905466
function shortcode_vimeo( $atts, $content= null ) { extract( shortcode_atts( array( 'id' => '', 'height' => 350, 'width' => 640, ), $atts ) ); $out = '<div id="vimeo"> <iframe src="http://player.vimeo.com/video/'.$id.'?byline=0&portrait=0&color=FFCC33" width="'.$width.'" height="'.$height.'" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen> </iframe> </div>'; return $out; } add_shortcode( 'vimeo', 'shortcode_vimeo' );
Shortcode pour Megavidéo :
La syntaxe dans l’article est: [megavideo id=lien_de_la_video]
Le lien de la vidéo se trouve ici (en gras): exemple http://www.megavideo.com/?v=NN496401
function shortcode_megavideo( $atts, $content= null ) { extract( shortcode_atts( array( 'id' => '', 'height' => 350, 'width' => 640, ), $atts ) ); $out = '<div id="megavideo"> <object width="'.$width.'" height="'.$height.'"> <param name="movie" value="http://www.megavideo.com/v/'.$id.'"></param> <param name="allowFullScreen" value="true"></param> <embed src="http://www.megavideo.com/v/'.$id.'" type="application/x-shockwave-flash" allowfullscreen="true" width="'.$width.'" height="'.$height.'"></embed> </object> </div>'; return $out; } add_shortcode( 'megavideo', 'shortcode_megavideo' );