wordpress获取缩略图的方法有很多,1、特色图片上传,2、自定义字段选择图片litpic;这2种方法是最常用的,但是有很多人觉得麻烦,有很站长想直接从文章中自动截图,下面小编给大家详细介绍一下。
1、打开主题函数模板functions.php,新增以下代码:
function wp_screenshot($atts, $content=null){ extract( shortcode_atts( array( "shots" => "https://www.ipkd.cn/uploads/", "url" => "https://ipkd.cn", "width" => "600", "height" => "450", "alt" => "screenshot" ), $atts ) ); $img = '<div class="wp-shot"><a href="' . $url . '" rel="external nofollow" target="_blank"><img src="' . $shots . '' . urlencode($url) . '?w=' . $width . '&h=' . $height . '" alt="' . $alt . '" /></a></div>'; return $img; } add_shortcode("shot", "wp_screenshot");
发表文章时,添加以下标签:
[shot url="https://ipkd.cn/" width="300" height="250"] //width,height可以默认设置也可以自定义
标签: wordpress建站, 截图
上面是“wordpress如何直接从文章中自动截图”的全面内容,想了解更多关于 wordpress 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_3329.html
workflows工作流
一位身着传统红色服装的女战士ComfyUI工作流
一只在森林里漫步的麋鹿ComfyUI工作流
一张由表情符号组成的照片ComfyUI工作流
一只处于战斗状态下的蚂蚁ComfyUI工作流
森林里一只空灵的犀鸟ComfyUI工作流
一只可爱的雪豹在雪地里散步ComfyUI工作流
一个骷髅海盗船长ComfyUI工作流
一个男孩在吃西瓜ComfyUI工作流
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!