logo

$20
custom video plugin/function needed

I need a bit of a plugin, could be function (to paste in functions.php) which would in place of tag like:

[video width="400" height="300"]source url here[/video]

inject embed code for videoplayer.swf?width=400&height=400=src

I have a swf, I need only content parsing function.

thanks,
tk

tomasz kozysa | 04/28/10 at 10:40am | Edit


(2) Possible Answers Submitted...

  • avatar
    Last edited:
    04/28/10
    11:16am
    Utkarsh Kukreti says:

    <?php
    function sc_video($atts, $content)
    {
    extract (shortcode_atts(array('width' => '400', 'height' => '300'),$atts));
    $r = <<<OUT
    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="$width" height="$height">
    <param name=movie value="$content?width=$width&height=$height"> <param name=quality value=high><embed src="$content?width=$width&height=$height" quality=high width="$width" height="$height" type="application/x-shockwave-flash"></embed> </object>
    OUT;
    return $r;
    }

    add_shortcode('video', 'sc_video');

    ?>

    Previous versions of this answer: 04/28/10 at 11:03am | 04/28/10 at 11:04am | 04/28/10 at 11:07am | 04/28/10 at 11:09am

  • avatar
    Last edited:
    04/28/10
    11:03am
    Lew Ayotte says:

    For this shortcode: [video width="400" height="300"]source url here[/video]

    Try adding this to your functions.php:


    // [video width='' height='']content[/video]
    function video_func($atts, $content = null ) {
    extract(shortcode_atts(array(
    'width' => '400', //default, if not defined
    'height' => '300', //default, if not defined
    ), $atts));

    // use $content for the video source
    // use {$width} for the width -- with the brackets
    // use {$height} for the height -- with the brackets

    $output = "your embed code with your new variables":

    return $output;
    }
    add_shortcode('video', 'video_func');

This question has expired.





Current status of this question: Completed