Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Change plugin from embedding youtube embed code WordPress

  • SOLVED

I have a plugin called MyVideo Poster 2.

It automatically embeds youtube videos from a specified user. Within the plugin you can specify a custom field to drop the embed code in. What I would like it to do is instead of dropping in the embed code I would like it to drop in the url of the video.

For example:

Current setting:
<iframe title="YouTube video player" width="640" height="390" src="http://www.youtube.com/embed/V38oYFSwn8c" frameborder="0" allowfullscreen></iframe>

Modified setting:
http://www.youtube.com/watch?v=V38oYFSwn8c

The plugin is available for download here:
http://dl.dropbox.com/u/14299011/myvideoposter.zip

Answers (2)

2011-03-31

Denzel Chia answers:

Hi,

Thanks for sending me a message.
Not sure what you want. I assume you want to update_post_meta with url instead of embed code.

Open up myvideoposter.php with an editor that has line numbers.
go to line number 1575
change;


update_post_meta($postresult, $myvideoposter_custommetadatanamevideo, $yembed);


to

update_post_meta($postresult, $myvideoposter_custommetadatanamevideo, $embedyurl);


Thanks.
Denzel


kayode brown comments:

Thanks for the rapid reply,

I tried that and it it did the following:

z2lZKn3TdKk

instead of

http://www.youtube.com/v/z2lZKn3TdKk


Denzel Chia comments:

Hi,

Ok, maybe a quick hack to reconstruct back url can fixed that.

Now use this instead.
change line 1575 to


$full_url = "http://www.youtube.com/v/".$embedyurl;
update_post_meta($postresult, $myvideoposter_custommetadatanamevideo, $full_url);


Thanks.


kayode brown comments:

I tried that and now its blank.


Denzel Chia comments:

Hi,

Never mind. Is this on your test blog?
If yes, please eamil me ftp access and admin access to email[at]denzeldesigns.com

I will add it into the script myself.
Do not want to waste anymore time here.

WPQuestions is breaking the code I posted.
Try again here.



$full_url = "http://www.youtube.com/v/".$embedyurl;
update_post_meta($postresult, $myvideoposter_custommetadatanamevideo, $full_url);



Thanks.
Denzel


kayode brown comments:

I didn't close it. one second let me try again.

2011-03-31

Lew Ayotte answers:

You know WordPress does this automatically, all you need to do is paste the URL of the video you want to embed...

[[LINK href="http://codex.wordpress.org/Embeds"]]http://codex.wordpress.org/Embeds[[/LINK]]


kayode brown comments:

I know, but I want it to be an automatic feature. This plugin runs as a cron, therefore making the site updated every hour.


Lew Ayotte comments:

I don't follow... WordPress' oEmbed feature is automatic. No extra plugins necessary. (see the link)


kayode brown comments:

You would still have to copy the url of the youtube video. This plugin runs automatically. Meaning, I would upload a video to my youtube channel, and my website (this plugin) would automatically check my youtube rss feed and update my website accordingly.

Here this is the plugin in.
http://cleverplugins.com/shop/videoposter2/


Lew Ayotte comments:

Oh, I see... I thought you just wanted to be able to paste the video URL in a post.