Skip to content

Instantly share code, notes, and snippets.

@joedolson
Last active November 1, 2023 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joedolson/c4fdc966e1d29c2ca38fcaa08fa37064 to your computer and use it in GitHub Desktop.
Save joedolson/c4fdc966e1d29c2ca38fcaa08fa37064 to your computer and use it in GitHub Desktop.
Load Wowza in WordPress
/**
* Embed a Wowza streaming player in WordPress. Maps the `$` function to `jQuery.noConflict()` before running embed so that variable is available.
* Usage: [wowza url="//player.video.wowza.com/hosted/WOWZA_ID/wowza.js"]
*
* @param array $atts Shortcode attributes.
* @param string $content Container content. Not used.
*
* @return string
*/
function embed_wowza( $atts, $content ) {
$atts = shortcode_atts(
array(
'url' => '',
),
$atts,
'wowza'
);
if ( ! $atts['url'] ) {
return '';
}
return "<script>(function (jQuery) {window.$ = jQuery.noConflict();})(jQuery);</script>
<div id='wowza_player'></div><script id='player_embed' src='" . esc_url( $atts['url'] ) . "' type='text/javascript'></script>";
}
add_shortcode( 'wowza', 'embed_wowza' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment