Skip to content

Instantly share code, notes, and snippets.

@jennimckinnon
Created January 20, 2016 05:34
Show Gist options
  • Save jennimckinnon/995502371d58977eb8be to your computer and use it in GitHub Desktop.
Save jennimckinnon/995502371d58977eb8be to your computer and use it in GitHub Desktop.
<?php
wp_embed_register_handler( 'forbes', '#http://(?:www|video)\.forbes\.com/(?:video/embed/embed\.html|embedvideo/)\?show=([\d]+)&format=frame&height=([\d]+)&width=([\d]+)&video=(.+?)($|&)#i', 'wp_embed_handler_forbes' );
function wp_embed_handler_forbes( $matches, $attr, $url, $rawattr ) {
$embed = sprintf(
'<iframe src="http://www.forbes.com/video/embed/embed.html?show=%1$s&format=frame&height=%2$s&width=%3$s&video=%4$s&mode=render" width="%3$spx" height="%2$spx" frameborder="0" scrolling="no" marginwidth="0" marginheight="0"></iframe>',
esc_attr($matches[1]),
esc_attr($matches[2]),
esc_attr($matches[3]),
esc_attr($matches[4])
);
return apply_filters( 'embed_forbes', $embed, $matches, $attr, $url, $rawattr );
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment