Created
July 11, 2017 20:17
-
-
Save gjjones/7cbbe194dc58889449d83d05ee6459c9 to your computer and use it in GitHub Desktop.
Dealing with oEmbed
This file contains 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
require_once( ABSPATH . 'wp-includes/class-oembed.php' ); | |
$WP_oEmbed = new WP_oEmbed(); | |
$data = $WP_oEmbed->get_data( $video_url ); | |
$thumbnail_url = $data->thumbnail_url; | |
// to be stored in data attribute until needed | |
$lightbox_markup = htmlentities( $WP_oEmbed->data2html( $data, $video_url), ENT_QUOTES ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment