mkormendy
10/20/2015 - 3:34 PM

Uses a shortcode to output a real-time thumbnail of any website.

Uses a shortcode to output a real-time thumbnail of any website.

// 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://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");

// Use [snap url="http://torquemag.io/" alt="WPDaily Website" w="400" h="300"]