分享好友 资讯首页 资讯分类 切换频道

在WordPress文章中自动获取网站截图

2025-07-23 03:5030admin001

下面由wordpress教程栏目给大家介绍如何在wordpress文章中自动获取网站截图,希望对需要的朋友有所帮助!

一、短代码

将下面的代码添加到当前主题函数模板functions.php中:

functionwp_screenshot($atts,$content=null){extract(shortcode_atts(array("shots"=>"https://s0.wordpress.com/mshots/v1/","url"=>"https://www.wpbeginner.com","width"=>"600","height"=>"450","alt"=>"screenshot"),$atts));$img='<divclass="wp-shot"><ahref="'.$url.'"rel="externalnofollow"target="_blank">@@##@@</a></div>';return$img;}add_shortcode("shot","wp_screenshot");
举报
收藏 0
打赏 0
评论 0
dedecms怎么添加会员功能

0评论2025-07-3139

dedecms好操作吗

0评论2025-07-3139

WordPress织梦哪个快

0评论2025-07-3138

dedecms如何修模板

0评论2025-07-3138