WordPress.org

Ready to get started?Download WordPress

Forums

Plugin avail to convert WP.com's YouTube shortcode? (3 posts)

  1. invisiblelimb
    Member
    Posted 3 years ago #

    I just exported posts/media from a WordPress.com hosted site to an independently hosted install for a friend. I'm looking for a quick plugin that will convert years of old posts that used WordPress.com's media shortcode (i.e. [youtube=http://www.youtube.com/watch?v=ovSQvI02rec] ) into actual embedded video. Right now the posts only show the actual shortcode text.

    Any fixes? Thanks in advance!

  2. invisiblelimb
    Member
    Posted 3 years ago #

    Is there no fix or plugin that converts the WordPress.com short code into working embeddable videos on a private install?

  3. Jack Reichert
    Member
    Posted 3 years ago #

    Post this into your theme's functions.php file:

    function youtubeSC($atts) {
    
    	return '<object width="425" height="344"><param name="movie" value="'.substr($atts[0],1).'?hl=en&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="'.substr($atts[0],1).'?hl=en&fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object>';
    }
    add_shortcode("youtube", "youtubeSC");

Topic Closed

This topic has been closed to new replies.

About this Topic