I wanted an easy solution for people to add videos from Vimeo to their WordPress articles (without having to add them to the editor for several reasons) and I came up with the following:
- a function to be added to the teme
- a piece of code to add to one or more templates(s) of the theme
- an extra field to fill in for each post or page by the editor of the website
The function
Add this to functions.php in your theme. It is based on the vimeo shortcode plugin for WordPress.
function insert_vimeo($clip_id) {
$width = '640';
$height = '360';
if (empty($clip_id) || !is_numeric($clip_id)) return '<!-- 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'
width='$width' height='$height' frameborder='0'></iframe>";
}
The piece of code for your template :
Put this in single.php or page.php, within the loop.
<?php
if ( get_post_meta($post->ID, 'vimeo', true) ) :
$vimeo = get_post_meta($post->ID, 'vimeo', true);
echo (insert_vimeo($vimeo));
endif;
?>
Now you just have to add an extra field called « vimeo » to your posts or pages and add as a value the ID of the clip, that means the numbers in the URL. If, for example, you want to add the video at http://vimeo.com/20732587 you would add 20732587 to the value of your field.

php-indexes generates an index of files in a defined folder, similar to the Apache file listing. Files may be ordered by name or date. It also generates an RSS feed. It does not require a database and is configurable via a simple config file for:
