在functions.php中做如下修改,你的主题就可以使用第二段代码,从而显示某个网页的截图,而不一定非要使用上传图片了,是不是还比较方便呢?
PHP
function wps_screenshot($atts, $content = null) {
extract(shortcode_atts(array(
"screenshot" => 'http://s.wordpress.com/mshots/v1/',
"url" => 'http://',
"alt" => 'screenshot',
"width" => '400',
"height" => '300'
), $atts));
return $screen = '<img src="' . $screenshot . '' . urlencode($url) . '?w=' . $width . '&h=' . $height . '" alt="' . $alt . '"/>';
}
add_shortcode("screenshot", "wps_screenshot");
shortcode
[screenshot url="http://wordpress.la" alt="wordpress code snippets for your blog" width="200" height="200"]
分类:新闻资讯