Share
ShareSidebar
2011-10-16 03:07:12 +0

display a thumbnail of any site in Wordpress

how to display a thumbnail of any website in Wordpress?

Rate this post

You must be registered to vote first

Comments

adam_g
adam_g 2011-10-16 03:26:07

1 - Create the shortcode. Paste the code in your functions.php file

function wpr_snap($atts, $content = null) {
    extract
(shortcode_atts(array(
               
"snap" => 'http://s.wordpress.com/mshots/v1/',
               
"url" => 'http://www.sharemycode.com',
               
"alt" => 'My image',
               
"w" => '400', // ancho
               
"h" => '300' // alto
                   
), $atts));
    $img
= '<img src="' . $snap . '' . urlencode($url) . '?w=' . $w . '&h=' . $h . '" alt="' . $alt . '"/>';
   
return $img;
}
add_shortcode
("snap", "wpr_snap");

2 - You can use the snap shortcode in your post or page

[snap url="http://www.sharemycode.com" alt="Descripción" w="400" h="300"]
+0

Comment