Created
July 13, 2016 23:10
-
-
Save mor10/727ad7a4751925ef3079995c2fe8e705 to your computer and use it in GitHub Desktop.
Generate automatic oEmbed from URL with Advanced Custom Field
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 | |
// Make sure the plugin is active | |
if ( function_exists( 'get_field' ) ) { | |
$lecture_video = get_field('lecture_video'); | |
} | |
// If the current post is a Lecture post and we have a lecture video URL, use oEmbed | |
if ( 'lecture' === get_post_type() ) { | |
if ( $lecture_video ) { | |
echo wp_oembed_get( $lecture_video ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment