WordPress shortcode – snapshot of website

Display a snapshot of any website, and place it on your blog?
Use a shortcode.
Paste the following code into your functions.php file:

 


function wpr_snap($atts, $content = null) {
        extract(shortcode_atts(array(
			"snap" => 'http://s.wordpress.com/mshots/v1/',
			"url" => 'http://www.ontwerps.nl',
			"alt" => 'My image',
			"w" => '400', // width
			"h" => '300' // height
        ), $atts));

	$img = '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
        return $img;
}

add_shortcode("snap", "wpr_snap");

Usage shortcode without thw first “:

["snap url="http://test.ontwerps.nl" alt="Description" w="400" h="300"]

Example:
[snap url=”http://www.google.nl” alt=”google” w=”400″ h=”300″]


Geplaatst

in

,

door

Tags:

Reacties

Geef een reactie

Het e-mailadres wordt niet gepubliceerd. Vereiste velden zijn gemarkeerd met *