1
我已經設置了一個自定義字段,您可以通過wordpress中的文本小部件添加youtube鏈接的結尾,然後從此處將函數添加到url中的iframe 。高級自定義字段 - 在Woocommerce模板上顯示YouTube視頻
下面是功能附加此頁面:
<?php if (($videoUrl = get_field('video_name', $post->ID)) != '') {
//Extract the url arguments (everything after the '?'
if (($query = parse_url($videoUrl, PHP_URL_QUERY)) != '') {
//Convert the arguments into an array for each access
parse_str($query, $arguments);
if (array_key_exists('v', $arguments)) {
//Create the embed code using the id from the 'v' argument
$videoId = $arguments['v'];
?>
<div class="videoContainer">
<iframe width="390" height="219" src="https://www.youtube.com/embed/<?= $videoId ?>?rel=0&showinfo=0" frameborder="0" allowfullscreen></iframe>
</div>
<?php
}
}
} ?>
我加入這個與內容然而,似乎沒有任何可以顯示靜止。可能有人請採用了先進的自定義字段幫助我發現任何錯誤。在WordPress模板
是什麼$ VideoID的返回 – 2015-03-19 01:47:16
檢查iframe和比賽的'src' URL,無論是預計YouTube網址或不... – 2015-03-19 04:25:49