Created
July 28, 2013 08:32
-
-
Save ovizii/6097954 to your computer and use it in GitHub Desktop.
Create a snapshot of any website
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function wp_snap($atts, $content = NULL) { | |
extract(shortcode_atts(array( | |
"snap" => ‘http://s.wordpress.com/mshots/v1/’, | |
"url" => ‘http://torquemag.io/’, | |
"alt" => ‘WPDaily’, | |
"w" => ’400′, // width | |
"h" => ’300′ // height | |
), $atts)); | |
$img = ‘<img alt="’ . $alt . ‘" src="’ . $snap . ” . urlencode($url) . ‘?w=’ . $w . ‘&h=’ . $h . ‘" />’; | |
return $img; | |
} | |
add_shortcode("snap", "wp_snap"); | |
//To use this shortcode just add the following to your post. | |
//[code][snap url="http://torquemag.io/" alt="WPDaily Website" w="400" h="300"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment