Coded something up in Couch in an interesting way? Have a snippet or shortcode to share? Post it here for the community to benefit.
3 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(
         'width' => '475',
         'height' => '350',
      ), $params) );

      // Sanitize parameters
      $id = htmlspecialchars( $id, ENT_QUOTES );
      $width = (int)$width;
      $height = (int)$height;
      // Output HTML
      $html =<<<EOS
      <iframe src="//$id?byline=0&amp;portrait=0&amp;badge=0" width="$width" height="$height" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe>
      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!!
3 posts Page 1 of 1

Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests
(based on users active over the past 5 minutes)

Users browsing this forum: No registered users and 2 guests