在functions.php中做如下修改,你的主题就可以使用第二段代码,从而显示某个网页的截图,而不一定非要使用上传图片了,是不是还比较方便呢?PHP

在functions.php中做如下修正,你的主题就可以运用第二段代码,然后显现某个网页的截图,而不一定非要运用上传图片了,是不是还比较便利呢?

文章中显现网页截图(网页内容截图)  代码 截图 插件与修改 文章 显示 新闻资讯 第1张

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"]

转载请说明出处
知优网 » 文章中显现网页截图(网页内容截图)

发表评论

您需要后才能发表评论