Google Blogoscoped

Forum

Paste YouTube on Wordpress

Hong Xiaowan [PersonRank 10]

Saturday, July 28, 2007
16 years ago3,059 views

Test some plugins, so complex. I did a simple job: Also can paste on other pages

<script>
youtube="uuZQWooEsy0";
</script>
<script src=http: //www.yourdomain.com/youtube.js></script>

youtube.js:

document.write('<object width="425" height="350"><param name="movie" value="http: //www.youtube.com/v/'+youtube+'"></param><param name="wmode" value="transparent"></param><embed src="http: //www.youtube.com/v/'+youtube+'" type="application/x-shockwave-flash" wmode="transparent" width="425" height="350"></embed></object>');

[I tried to optimize code display due to forum auto-linking problems.... -Philipp]

Hong Xiaowan [PersonRank 10]

16 years ago #

How to paste code?

Hong Xiaowan [PersonRank 10]

16 years ago #

Click this post:
http://www.hongxiaowan.com/2007/07/27/paste-youtube-on-wordpress/

Hong Xiaowan [PersonRank 10]

16 years ago #

Thanks Philipp.

Haochi [PersonRank 10]

16 years ago #

You should write that in a function instead, so you don't have to call the JS file every time. (whether cached or not)

Note that WP's Visual Editor breaks scripts/multimedia contents.

stefan2904 [PersonRank 10]

16 years ago #

And whats with this?
http://img514.imageshack.us/img514/9189/95991956cj9.jpg

Paul Fisher [PersonRank 1]

16 years ago #

Stefan, I think that's for Wordpress.com users. Hong's solution is for self-hosted Wordpress users. I think there are also several plugins for Wordpress that allow you to easily post YouTube.

Hong Xiaowan [PersonRank 10]

16 years ago #

[put at-character here]Haochi
Thanks, I will try. If we can join multiscript at one JS file. Including Google Search API, Feed API, Google Adsense, ect...

I wish Google can supply this script for us. They will do the best. And, if I put this script for public using, I think, my sever will down at once.

So just want to make YouTube notice that we need simple way to paste video. And, we just need one JS from Google, not too many JS files.

stefan2904 [PersonRank 10]

16 years ago #

[put at-character here]Paul: Easy to self-develop. just one regular str_replace!

foe example (for my own blog system, not for wordpress!):
$post_content= preg_replace('/[youtube=(w+)]/i',$tpl->replace('youtube-id','$1',$tpl -> toString($tpl->getTPL('youtube'))),$post_content);

[Line break added for layout reasons – Tony]

Forum home

Advertisement

 
Blog  |  Forum     more >> Archive | Feed | Google's blogs | About
Advertisement

 

This site unofficially covers Google™ and more with some rights reserved. Join our forum!