サウンド クラウドから iframe が埋め込まれた wordpress データベースがあります。iframe をある種のショートコードに置き換えたい。ショートコードも作成しましたが、かなりうまく機能します。
問題は、既にコードが埋め込まれている約 2000 の投稿がある古いデータベースがあることです。私がやりたいのは、iframeをショートコードに置き換えるようにコードを書くことです。
これは、コンテンツからURLを見つけるために使用しているコードですが、常に空白を返します。
$string = 'Think Kavinsky meets Futurecop! meets your favorite 80s TV show theme song and you might be pretty close to Swedish producer Johan Bengtsson\'s retro project, <a href="https://soundcloud.com/daataa"><strong>Mitch Murder</strong></a>. Title track, "The Touch," is genuinely lighthearted and fun, crossing over from 80s synth work into a bit of French Touch influence; also including a big time guitar solo straight out of your dad\'s record collection. B-side "Race Day" could very easily be the soundtrack to a video montage of all of your favorite beach scenes from every 80s movie you\'ve ever watched, or as the PR put it, "quite possibly a contender to be the title screen music to a Wave Race 64 sequel." Sounds awesome to me. Also included in this package out today on <a href="https://soundcloud.com/maddecent/">Mad Decent</a>\'s Jeffree\'s sub-label are two remixes of the A-side from Lifelike and Nite Sprite. Download below.
<iframe src="https://w.soundcloud.com/player/?url=http%3A%2F%2Fapi.soundcloud.com%2Fplaylists%2F8087281&color=000000&auto_play=false&show_artwork=true" frameborder="no" scrolling="no" width="100%" height="350"></iframe>';
preg_match("/url=(.*?)/", $string, $matches);
print_r($matches);
上記のコードは機能せず、私は正規表現にあまり詳しくないので、ここで何が問題なのかを誰かが理解できれば、それは素晴らしいことです. また、誰かがこれを行うための正しいプロセスを案内してくれるなら、それは素晴らしいことです.