Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ShaneGowland/5546561 to your computer and use it in GitHub Desktop.
Save ShaneGowland/5546561 to your computer and use it in GitHub Desktop.
Create a screenshot of any website
function wp_snap($atts, $content = NULL) {
extract(shortcode_atts(array(
"snap" => 'http://s.wordpress.com/mshots/v1/',
"url" => 'http://wpdaily.co/',
"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");
// Use [snap url="http://wpdaily.co/" 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