Recently on a client WordPress website I needed a simple way to get Vimeo video thumbnails via video ID. I couldn’t find anything readily available or even a snippet, so I created a function that helps out and even has a return or echo option as well.
[code]function get_vimeo_thumb($videoid, $size = “large”, $return = false)
{
$imgid = $videoid;
$hash = unserialize(file_get_contents(“http://vimeo.com/api/v2/video/$imgid.php"));
$the_thumb = “;
switch ($size) {
case ‘small’:
$the_thumb = $hash[0][’thumbnail_small’];
break;
case ‘medium’:
$the_thumb = $hash[0][’thumbnail_medium’];
break;
case ’large’:
$the_thumb = $hash[0][’thumbnail_large’];
break;
}
There seems to be a lot of outdated code out there from WordPress 2.x days on how to redirect a user to any page of your choosing after logging in, the below code will redirect a user to the homepage directly after logging in without taking them to the usual admin panel (in-case you have a custom page you want users to see).
This post is more of a self-reference for future projects, but thought I would share.
WordPress has a genius and at the same time annoying feature that automatically wraps inline elements in “P” tags for you. The nerd that wrote the function “wpautop” forgot to provide us an option to populate the array of defined block level elements in-case we wanted an image or perhaps even a span tag treated as a block level element and not wrapped in a P tag automatically.
After much research and not find a single straight forward answer that worked, I devised my own little solution. Basically what we have to do is create a new function called “wpautop_forked” inside of your theme functions.php file and then remove the annoying wpautop filter function and specifying our own instead. Here is the code below, function taken from the wp-includes file formatting.php for the latest version of WordPress at the time of writing 3.0.4. View the file and function on WordPress Trac here.