wblake37 Posted July 19, 2011 Share Posted July 19, 2011 Hi there, and thanks for clicking my thread I have a problem I cant work out what the best way to resolve it because of my limited knowledge with php etc. I basically want to mass edit all wordpress posts on my blog (6,801) They are all youtube videos so they look kind of look like this: <object width="425" height="355"><param name="movie" value="http://www.youtube.com/watch?v=c5CcWoSzYj4?fs=1" /><param name="allowFullScreen" value="true" /> <embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/watch?v=c5CcWoSzYj4?fs=1&rel=0" allowfullscreen="true"></embed></object> I want to pull that youtube url then replace it all with this code <script type='text/javascript' src='jwplayer.js'></script> <div id='mediaspace'>This text will be replaced</div> <script type='text/javascript'> jwplayer('mediaspace').setup({ 'flashplayer': 'player.swf', 'file': 'http://www.youtube.com/watch?v=c5CcWoSzYj4?fs=1', 'controlbar': 'bottom', 'width': '470', 'height': '320' }); </script> Would this be possible? I have basic php/html knowledge but from what i understand i need. Some sort of script to read the url inside the <object> tag then replace it all with the new jwplayer code (looks so much better) Thanks for reading, any thought towards this is much appreciated. Link to comment https://forums.phpfreaks.com/topic/242339-wordpress-mass-post-edit/ Share on other sites More sharing options...
wildteen88 Posted July 19, 2011 Share Posted July 19, 2011 Yes you can use preg_replace for this. regular-expressions.info is a great place for learning regular expressions. Link to comment https://forums.phpfreaks.com/topic/242339-wordpress-mass-post-edit/#findComment-1244701 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.