Last active
December 18, 2015 22:08
-
-
Save kovshenin/5852083 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function mlbtv_shortcode( $attr, $content = '' ) { | |
$attr = shortcode_atts( array( | |
'id' => null, | |
'width' => 400, | |
'height' => 224, | |
), $attr ); | |
$attr = array_map( 'absint', $attr ); | |
$url = add_query_arg( array( | |
'content_id' => $attr['id'], | |
'width' => $attr['width'], | |
'height' => $attr['height'], | |
'property' => 'mlb', | |
), 'http://wapc.mlb.com/shared/video/embed/embed.html' ); | |
return sprintf( '<iframe src="%s" width="%d" height="%d" frameborder="0">Your browser does not support iframes.</iframe>', esc_url( $url ), $attr['width'], $attr['height'] ); | |
} | |
add_shortcode( 'mlbtv', 'mlbtv_shortcode' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment