wordpress上传图片不自动生成缩略图的解决方法

所属分类: CMS教程 / WordPress 阅读数: 2117
收藏 0 赞 0 分享

因为站点不需要显示这么多图片,只需要原图就OK了,所以就要修改下媒体设置。打开设置->媒体,将不需要的缩略图宽度高度都设置为0就可以了。如下图:



但是这样设置之后,还是会生成其它分辨率的缩略图,笔者猜测应该是主题的问题,于是就去主题内查找,笔者用的主题是themolio。后来在主题文件的functions.php中找到了这样的代码:


复制代码
代码如下:

function themolio_setup() {</p> <p> /* Make Themolio available for translation.
* Translations can be added to the /languages/ directory.
* If you're building a theme based on Themolio, use a find and replace
* to change 'themolio' to the name of your theme in all the template files.
*/
load_theme_textdomain('themolio', get_template_directory().'/languages' );
add_editor_style();
add_theme_support('automatic-feed-links');
add_theme_support('post-thumbnails');</p> <p> /**
* This sets up the image size for the grid based top-down layouts (with no sidebar).
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-two-col-grid-image-nosidebar',460,300,true);
add_image_size('themolio-three-col-grid-image-nosidebar',290,200,true);
add_image_size('themolio-four-col-grid-image-nosidebar',210,150,true);</p> <p> /**
* This sets up the image size for the grid based top-down layouts (with sidebar).
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-two-col-grid-image-sidebar',356,250,true);
add_image_size('themolio-three-col-grid-image-sidebar',230,150,true);
add_image_size('themolio-four-col-grid-image-sidebar',171,110,true);</p> <p> /**
* This sets up the image size for the featured image.
* If you change the width/height of your content,
* you will have to modify the width and height mentioned below as well
*/
add_image_size('themolio-featured-image',800,300,true);</p> <p> register_nav_menu('primary', __('Primary Menu', 'themolio'));</p> <p> add_theme_support('post-formats', array('link', 'gallery', 'status', 'quote', 'image', 'video'));</p> <p> if(themolio_is_wp_version('3.4')) {
add_theme_support('custom-background');
} else {
add_custom_background();
}
}

其中add_image_size就是增加缩略图设置的方法,根据需要注释掉即可。其它主题也可以依此类推,只要搜索关键词add_image_size,应当就能找到缩略图的设置。

最后生成多张缩略图的问题就搞定了。

友情提示

如果日后有需要缩略图,可以在媒体->媒体库->选择需要的图片点编辑->编辑图片,然后就可以裁剪图片了。最后报下wordpress和使用主题的版本:

wordpress是3.4.1版本
主题是Themolio,版本是1.2

更多精彩内容其他人还在看

禁止wordpress自动将半角转换为全角 禁止全角和半角的转换

发布文章时WordPress会自动将代码中的单双引号转换为全角符号,分享代码特别不方便,解决方法如下
收藏 0 赞 0 分享

wordpress评论者链接在新窗口中打开的方法

WordPress点击评论者链接是在本窗口内打开,用户体验不是特别好,介绍一下wordpress评论者链接在新窗口中打开的方法,解决方法如下
收藏 0 赞 0 分享

WordPress中让Widget 标题支持简单的HTML标签

在默认情况下,WordPress 的 Widget 标题是不支持任何 HTML 标签的,下面的技巧教你使用简单的代码替换实现在 Widget 标题实现支持 HTML 标签
收藏 0 赞 0 分享

不使用wordpress插件添加页面关键词和描述信息

WordPress存在一个问题,就是页面中keywords和description信息的缺失,其实这个工作应该由主题来完成,遗憾的是大部分主题并没有涉及,因此造成这两个信息的缺失,对于SEO很不利。下面说下如何用非插件的方式在模板中实现keywords和description的调
收藏 0 赞 0 分享

wordpress数据库优化和清理冗余数据的方法

本文主要介绍了wordpress数据库优化和清理冗余数据的方法,大家参考使用吧
收藏 0 赞 0 分享

wordpress博客多站点获取当前博客信息示例

在开通WordPress多站点之后,你或许需要在插件中获取当前的博客信息。本文帮你解决这个问题
收藏 0 赞 0 分享

wordpress恶意代码解决方法分享

发现自己的测试站的主题带上了恶意代码,非常明显的就是出现了一个函数_verifyactivate_widgets,通常情况下,一旦出现了这个函数在你的主题中,使用PHP可以任意的获取用户名、博客的主题文件等等,下面是解决方法
收藏 0 赞 0 分享

wordpress中短代码失效解决办法

在WordPress中我们偶尔会使用短代码,但是在一些特殊的主题中,我们偶尔会发现,短代码失效了,没有显示为我们想要的音乐播放器,却只显示为原本的字符串。这个时候,你可能需要对主题进行一些简单的处理来实现这个打印效果
收藏 0 赞 0 分享

wordpress文章标题为空时其它内容代替的方法

本文主要介绍了wordpress文章标题为空时使用其它内容代替的方法,大家参考使用吧
收藏 0 赞 0 分享

为wordpress绑定多个域名的方法分享

本文主要介绍了WordPress绑定多个域名的方法,wordpress默认情况下会自动跳转到后台规定的home_url上去,如何实现绑定多个域名的功能,详细看下文吧
收藏 0 赞 0 分享
查看更多