我使用的是最新版本的wordpress,現在我的網站上有大約10000個帖子。如何將我的wordpress文章中的每個youtube鏈接轉換爲嵌入?
我有一個不錯的插件,使我的網站看起來更加寬容,但我需要爲每個特色圖像廣告一個簡單的代碼,並且每個嵌入的YouTube視頻都在我的帖子中(如果我可以選擇添加它的用戶這將是完美的!),以得到它的工作
我知道YouTube嵌入代碼是
<iframe width="560" height="315" src="//www.youtube.com/embed/NrH9CqnzzRU?list=PLHPcpp4e3JVpXbtgyD-k-nCmwpbbMIHOh" frameborder="0" allowfullscreen></iframe>
什麼,我需要做的是添加
<div class="featuredvideo"><iframe width="560" height="315" src="//xxxxxxxxxxxxxxxxxxxxxxxxx" frameborder="0" allowfullscreen></iframe></div>
,所以我想牛逼Ø添加這些東西前,和「XXXX」 S
後我不是一個程序設計師,所以請給我的代碼
我知道,AJAX可以搜索整個文件夾下面類似的代碼
<button>AJAX</button>
<br>
<div id = "container"></div>
<script type="text/javascript">
$("button").click(function(){
$.get("sample.html",function(data){
$("#container").html(data);
})
});
這隻會從文件中獲取html,但現在我想在這裏做。
請幫幫我,給我一個插件或代碼
工作謝謝
所以,你想檢測的YouTube的iframes和包裝他們的div? – Archer 2014-12-02 14:22:32
是的,這就是我想要做的! – 2014-12-02 17:06:47
好的 - 沒問題。我會添加一個答案。 – Archer 2014-12-02 18:00:09