WordPress.org

Ready to get started?Download WordPress

Forums

Vimeo Short Code
autoplay functionality (3 posts)

  1. webjumbo
    Member
    Posted 2 years ago #

    Hi,

    first of all thanks for your work!

    I've modified the plugin code to make videos' autoplay possible .

    This is the updated code:

    /*
    Plugin Name: Vimeo HTML5 shortcode
    Plugin URI: http://blog.esimplestudios.com/2010/08/embedding-vimeo-videos-on-wordpress
    Description: Allows the user to embed Vimeo movie clips by entering a shortcode ([vimeo]) into the post area.
    Author: Gabriele Maidecchi
    Version: 1.0
    Author URI: http://www.esimplestudios.com/
    License: GPL 2.0, @see http://www.gnu.org/licenses/gpl-2.0.html
    
    EDITED BY MAIDO 2010-08-18 to support new Vimeo HTML5-friendly embed code
    
    Full credits go to the original version of the plugin, below:
    
    Plugin Name: Lux Vimeo
    Plugin URI: http://www.partnervermittlung-ukraine.net/info/lux-vimeo-wordpress-plugin
    Description: Allows the user to embed Vimeo movie clips by entering a shortcode ([vimeo]) into the post area.
    Author: Matroschka
    Author URI: http://www.pastukhova-floeder.de/
    */
    
    class lux_vimeo {
        function shortcode($atts, $content=null) {
    		extract(shortcode_atts(array(
    			'clip_id' 	=> '',
    			'width' 	=> '400',
    			'height' 	=> '225',
    			'autoplay' 	=> '0',
    		), $atts));
    
    		if (empty($clip_id) || !is_numeric($clip_id)) return '<!-- Lux Vimeo: Invalid clip_id -->';
    		if ($height && !$width) $width = intval($height * 16 / 9);
    		if (!$height && $width) $height = intval($width * 9 / 16);
    
    		return "<iframe src='http://player.vimeo.com/video/$clip_id?title=0&byline=0&portrait=0&autoplay=$autoplay' width='$width' height='$height' frameborder='0'></iframe>";
        }
    }
    
    add_shortcode('vimeo', array('lux_vimeo', 'shortcode'));

    thanks,

    Giorgio

    http://wordpress.org/extend/plugins/lux-vimeo-shortcode/

  2. James
    Member
    Posted 2 years ago #

    Well done for getting this up and running Giorgio. I've taken what you've done and implemented it into the latest version of the plugin (1.1).

    Here's the code:

    <?php
    /*
    Plugin Name: Lux Vimeo
    Plugin URI: http://www.partnervermittlung-ukraine.net/info/lux-vimeo-wordpress-plugin
    Description: Allows the user to embed Vimeo movie clips by entering a shortcode ([vimeo]) into the post area.
    Author: Matroschka
    Version: 1.1
    Author URI: http://www.pastukhova-floeder.de/
    License: GPL 2.0, @see http://www.gnu.org/licenses/gpl-2.0.html
    */
    
    class lux_vimeo {
        function shortcode($atts, $content=null) {
    		extract(shortcode_atts(array(
    			'clip_id' 	=> '',
    			'width' 	=> '400',
    			'height' 	=> '225',
    			'title'	=> '1',
    			'byline'	=> '1',
    			'portrait'	=> '1',
    			'color'		=> '',
    			'html5' 	=> '1',
    			'autoplay' 	=> '0',
    		), $atts));
    
    		if (empty($clip_id) || !is_numeric($clip_id)) return '<!-- Lux Vimeo: Invalid clip_id -->';
    		if ($height && !$atts['width']) $width = intval($height * 16 / 9);
    		if (!$atts['height'] && $width) $height = intval($width * 9 / 16);
    
    		return $html5 ?
    			"<iframe src='http://player.vimeo.com/video/$clip_id?title=$title&byline=$byline&portrait=$portrait&autoplay=$autoplay' width='$width' height='$height' frameborder='0'></iframe>" :
    			"<object width='$width' height='$height'><param name='allowfullscreen' value='true' />".
        			"<param name='allowscriptaccess' value='always' />".
        			"<param name='movie' value='http://vimeo.com/moogaloop.swf?clip_id=$clip_id&server=vimeo.com&show_title=$title&show_byline=$byline&show_portrait=$portrait&color=$color&fullscreen=1&autoplay=$autoplay' />".
        			"<embed src='http://vimeo.com/moogaloop.swf?clip_id=$clip_id&server=vimeo.com&show_title=$title&show_byline=$byline&show_portrait=$portrait&color=$color&fullscreen=1' type='application/x-shockwave-flash' allowfullscreen='true' allowscriptaccess='always' width='$width' height='$height'></embed></object>".
        			"<br /><a href='http://vimeo.com/$clip_id'>View on Vimeo</a>.";
        }
    }
    
    add_shortcode('vimeo', array('lux_vimeo', 'shortcode'));
    
    ?>
  3. smogdog
    Member
    Posted 1 year ago #

    Hi
    I'm using this plugin, simple and works like it's meant to:-)

    But I can't get the color to display, I've added the short code color="37ab88" but it still diplays the "vimeo blue"

    Any help is appreciated

    Cheers

    Hans g

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic