Wednesday, August 24, 2011

Display a thumbnail of any website in wordpress

In WordPress we can display a thumbnail of any website. Wordpress have a service named mShots, Its allow us to get snapshots of any website. We can use a shotcode to easily display a snapshot of a given website.


To create the shortcode ,just paste the following code into functions.php file.



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

$img = '' . $alt . '';
return $img;
}

add_shortcode("snap", "wpr_snap");


Now use the following shortcode to display any snaphot

[snap url="http://www.sandipdas.in" alt="description" w="500" h="400"]

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off