Last active
December 18, 2015 14:08
-
-
Save wpspeak/5794617 to your computer and use it in GitHub Desktop.
Output a snapshot of any website!
This file contains hidden or 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
<?php | |
// Output a snapshot of any website! | |
function wp_snap($atts, $content = NULL) { | |
extract(shortcode_atts(array( | |
"snap" => 'http://s.wordpress.com/mshots/v1/', | |
"url" => 'http://wpspeak.com/', | |
"alt" => 'WPSpeak', | |
"w" => '600', // width | |
"h" => '400' // 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://wpspeak.com/" alt="WPDaily Website" w="600" h="400"] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment