Skip to content

Instantly share code, notes, and snippets.

@kovshenin
Last active December 18, 2015 22:08
Show Gist options
  • Save kovshenin/5852083 to your computer and use it in GitHub Desktop.
Save kovshenin/5852083 to your computer and use it in GitHub Desktop.
<?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