为确保WordPress站点的图片展示更为简洁,我们只需保留原始图片即可。因此,需要对媒体设置进行适当调整。请按照以下步骤操作:
1. 进入“设置”菜单,选择“媒体”选项。
2. 在媒体设置中,将不需要的缩略图的宽度和高度参数均设置为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`来定位并修改缩略图设置。
通过这些步骤,您应该能够解决生成多张不必要缩略图的问题。
友情提示:
如果您在未来需要生成缩略图,可以通过以下步骤操作:
1. 进入“媒体”->“媒体库”。
2. 选择您需要编辑的图片。
3. 点击“编辑”按钮,然后进行图片裁剪。
最后,附上我所使用的WordPress和主题的版本信息:
WordPress版本:3.4.1
主题:Themolio,版本:1.2
希望这些信息对您有所帮助!
@版权声明:
本网站所展示的图片均来源于互联网,我们致力于尊重原创作者的版权。若图片涉及版权问题,或图片所有者不希望图片被展示,请与我们联系,我们将在第一时间进行处理,包括但不限于删除图片。我们对图片的版权问题持开放态度,并愿意与版权所有者进行沟通协商。感谢您的理解与支持。