View Single Post
Old 02-25-2013, 07:18 AM  
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,220
Code for Anyone use imgur.com links on wordpress

Curious if anyone does. I wrote a little piece of code that will let you just post image urls in your post box (similar to the way you can do automatica youtube embeds)

add this to your functions.php file

Code:
wp_embed_register_handler('imgur', '#https?://(.+\.)?imgur\.com/.*#i', 'wp_imgur_embed_handler');

function wp_imgur_embed_handler( $matches, $attr, $url, $rawattr ) {
	$embed = sprintf('<img src="%1$s" />',$url);
	$embed = apply_filters( 'oembed_imgur', $embed, $matches, $attr, $url, $rawattr );
	return apply_filters( 'oembed_imgur', $embed, $url, '' );
}
or you can download the plugin version https://github.com/chrismccoy/imgur
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote