Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
4 posts Page 1 of 1
I'm working with couch for 2 days and i like it verry much! The youtube shortcode works good now.
Does someone already made ​​a short code for vimeo videos?
I am very interested!

(sorry for my bad English)
Hi pimb and welcome :)

Try this as shortcode for vimeo
Code: Select all
     // Usage: [vimeo 40613192]
   $FUNCS->register_shortcode( 'vimeo', 'vimeo_handler' );
   function vimeo_handler( $params, $content=null ){
      global $FUNCS;
     
      extract( $FUNCS->get_named_vars(array(
         'id'=>'',
         'width' => '475',
         'height' => '350',
      ), $params) );

      // Sanitize parameters
      $id = htmlspecialchars( $id, ENT_QUOTES );
      $width = (int)$width;
      $height = (int)$height;
     
      // Output HTML
      $html =<<<EOS
      <iframe src="//player.vimeo.com/video/$id?byline=0&amp;portrait=0&amp;badge=0" width="$width" height="$height" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
EOS;
      return $html;
   }

Hope this helps. Let us know.

Note: (May 10, 2013) Revised the code to output the currently used markup for Vimeo videos, as suggested by @cheesypoof.
It works perfect. Thank you very much!!
Thanks a lot KK!
Is there a way to make the shortcode embed Vimeo clip so it is responsive, not a fixed size?
I know it can be done with css, but then Vimeo "auto resolution" fixes the resolution to 360p for some reason.
Alternatively not responsive in the shortcode, but fixed resolution?
4 posts Page 1 of 1