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

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

一、短代码

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

function wp_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 = '<div><a>@@##@@</a></div>';
return $img;
}
add_shortcode("shot", "wp_screenshot");
登录后复制

发表文章时,添加短代码:

[shot url="http://zmingcx.com/"]
登录后复制

自定义截图大小

[shot url="http://zmingcx.com/" width="600" height="450"]
登录后复制

修改其中的网址链接链接即可。

具体效果

以上就是在 WORDPRESS 文章中自动获取网站截图的详细内容,更多请关注慧达AI工具网其它相关文章!

转载请说明出处 内容投诉内容投诉
慧达seo-站长工具-seo工具-采集-发布-AI文章生成发布工具 » 在 WordPress 文章中自动获取网站截图

慧达AI专注站群seo管理工具

查看演示 官网购买