Echo do shortcode with custom field not working
the_field() prints the value, it doesn’t return the string, so you cannot use it in a variable. Use … $video = get_field(“video_file”); … instead.
the_field() prints the value, it doesn’t return the string, so you cannot use it in a variable. Use … $video = get_field(“video_file”); … instead.
According to the docs: http://codex.wordpress.org/Embeds as long as you have “Auto-embeds” checked in Administration > Settings > Media SubPanel you can paste in the youtube url and if it’s on its own line the video should be embedded. Alternatively you can wrap it in the embed short code e.g.
Thats more a youtube than a wordpress question. But you can write a simple shortcode function and add it to your site. // Add Shortcode function custom_youtubeapishortcode() { $playlistid = “XXXX”; $apikey = “XXXX”; $curl = curl_init(); curl_setopt_array($curl, array( CURLOPT_URL => “https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=”.$playlistid.”&maxResults=1&key=”.$apikey.””, CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => “”, CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION … Read more
Ok here is working code: function get_yts() { $query_args = array( ‘s’ => ‘youtube.com/watch?v=’, ); $posts = get_posts( $query_args ); foreach ($posts as $p) { $input_line = $p->post_content; $output_array = array(); preg_match(‘/http(?:s?):\/\/(?:www\.)?youtu(?:be\.com\/watch\?v=|\.be\/)([\w\-\_]*)(&(amp;)?[\w\?=]*)?/’, $input_line, $output_array); print_r($output_array); } }
This isn’t possible, youtube doesn’t provide an embed with an open playlist. If it did, this isn’t something that could be resolved from the WordPress end, as it’s a Youtube OEmbed issue. You will need to refer to Youtube documentation or their support channels
Old anwser What you are trying to is to import all your videos from your YouTube channel to your WordPress blog. Unfortunately YouTube is not providing any public web service that will allow external servers to get the kind of data you want to import. I don’t think you will find any plugin capable to … Read more
Turns out the YouTube video in question had Embedding disabled by request. Tested with other YouTube videos with a ‘dash’ and they work fine (if embedding is not disabled).
Personally, I found the oembed_dataparse filter pretty fiddly to use; sometimes it worked, sometimes it didn’t; and when used in conjunction with custom TinyMCE instances, it seems as though the added wrapper was hard-baked into the content rather than added via the filter at output. I found the embed_oembed_html filter much more reliable and works … Read more
WordPress does a pretty good job of embedding videos at the correct aspect ratio. The width of the embedded video is based on the content width set in your theme’s functions.php file. Because of this it sounds as if there may be some styles applied to the iframe element in your theme changing it’s size. … Read more
At the moment WordPress only recognises youtube.com/watch, youtube.com/playlist and youtu.be. However there is wp_oembed_add_provider; try something like wp_oembed_add_provider( ‘#http://(www\.)?youtube-nocookie\.com/embed.*#i’, ‘http://www.youtube-nocookie.com/oembed’, true ); (untested sorry). You could even overwrite the existing providers to redirect to -nocookie and then use the video shortcode as normal. And you can do this with add_filter(‘oembed_providers’, … ); too if you’d … Read more