如何在 WordPress 中更改默认图像缩略图大小
嘿..实际上很尴尬地问这个 - 我应该能够在 Google 上找到这个,但是由于所有新的 WP 功能以及旧版本中执行此操作的旧方法在我所使用的 Google 结果中都充满了问题利用某个好心人的知识。
我已经知道如何设置自定义缩略图大小(我正在开发杂志风格主题),目前我正在努力让我的画廊正常工作。当我选择“插入以发布”图像时,它给了我 4 个选项 - 小、中、大缩略图加上原始尺寸。
我需要知道,出于嵌入目的(而不是特色帖子缩略图),如何设置这些缩略图的默认大小,以便它们出现在帖子编辑屏幕的媒体部分中。
有什么想法吗?
Hey.. quite embarrassed to ask this actually - I should be able to find this on Google, but because of all the new WP functionality as well as the older methods of doing this in older versions are riddled all over Google Results that I have resorted to leverage the knowledge of a good samaritan out there somewhere.
I already know how to set up custom thumbnail sizes (I'm developing a Magazine style theme), and at the moment I'm working on getting my gallery working. When I choose to "insert to post" an image, it gives me 4 options - small, medium and large thumbnails plus the original size.
I need to know, for embedding purposes (not the featured post thumbnails), how to set the default sizes of these thumbnails so that they appear in the Media section of the Post editing screen.
Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我回答了我自己的问题,我觉得很愚蠢......哈哈。
它位于管理屏幕中。左栏..设置->媒体,它们就在那里。缩略图、中号和大号。无需文件修改,无需在functions.php 文件中进行自定义大小设置。
哎呀!
I answered my own question folks, and I feel quite dumb.. haha.
It was in the Admin screen. Left bar.. Settings -> Media, and there they are. Thumbnail, medium, and large sizes. No file hacks, no custom size settings in the functions.php file necessary.
Oops!
在 function.php 中添加以下代码:
Image Size Names : 'thumb', 'thumbnail', 'medium', 'large'
名称“thumb”和“thumbnail”只是别名
In function.php add this code:
Image Size Names : ‘thumb’, ‘thumbnail’, ‘medium’, ‘large’
The names “thumb” and “thumbnail” are just aliases
查看您的 WordPress 根文件夹,如下所示:
在此文件夹中,有一个名为:
media.php
的文件,从第 34 行开始,有一个函数:
在此函数中,从第 41 行开始,有以下内容代码。只需根据您的需要编辑此内容即可:
Look in your wordpress root folder as such:
In this folder there is a file called:
media.php
Starting on Line 34 there is a function:
in this function, starting on Line 41, there is the following code. Just edit this for your needs: