Support » Plugins » help adding simple tag to MCE

  • Hi All — if you go to you will likely see what i’m trying to do.

    I’m not very experienced with writing wp plugins. What I would like to do is create a simple tag (like

    <yte>{youtube video id}</yte> and have that expand when a post is viewed to the following:

    <object width="425" height="350"><param name="movie" value="{youtube video id}"></param><embed src="{youtube video id}" type="application/x-shockwave-flash" width="425" height="350"></embed></object>

    This seems fairly simple — just not sure i’m looking in the right places on where i’d add this type of code. Any help?


Viewing 1 replies (of 1 total)
  • Never mind — I figured it out — easy of course, once I could figure out where to put it!

    Plugin Name: You Tube Embed
    Plugin URI: <none yet>
    Description: Adds quicktags for embedding youtube videos in your blog
    Version: 1.0
    Author: Notwen
    Author URI: <none yet>


    Drop in your /wp-content/plugins/
    Activate the plug-in via admin


    add_filter('the_content', 'notwen_yte');

    function notwen_yte($post_content)
    $pattern ='@<yte>(.*?)</yte>@';
    $replace = '<object width="425" height="350"><param name="movie" value="$1"></param><embed src="$1" type="application/x-shockwave-flash" width="425" height="350"></embed></object>';
    return preg_replace ($pattern, $replace, $post_content);


Viewing 1 replies (of 1 total)
  • The topic ‘help adding simple tag to MCE’ is closed to new replies.