【发布时间】:2021-03-28 10:41:40
【问题描述】:
我想添加一个简码以将 youtube 视频添加到我的网站。我想用 cookiebot 屏蔽内容。
如果我添加一个没有任何短代码的 youtube 视频,代码如下所示:
<div class="cookieconsent-optout-marketing">
Please
<a href="javascript:Cookiebot.renew()">accept marketing-cookies</a> to watch this video.
</div>
<iframe data-src="https://www.youtube.com/embed/xxxxxxxxxxx" data-cookieconsent="marketing" frameborder="0" allowfullscreen></iframe>
所以我很难使用简码。我只知道如何添加新的简码。到目前为止,这是我的简码:
<?php
function youtube_function()
{
$output = '
<div class="cookieconsent-optout-marketing">
Please <a href="javascript:Cookiebot.renew()">accept marketing-cookies</a> to watch this video.
</div>
<iframe data-src="https://www.youtube.com/embed/xxxxxxxxxxx" data-cookieconsent="marketing" frameborder="0" allowfullscreen></iframe>';
return $output;
}
add_shortcode('ytvideo', 'youtube_function');
?>
现在我想替换链接或者 xxxxxxxxxx 部分。我希望有人想帮助我:)
【问题讨论】:
标签: php wordpress cookies shortcode