WordPress裁剪缩略图未显示
我正在尝试在WordPress中显示自定义的裁剪缩略图。
这是我的代码:
add_image_size('about-us-slider-image', 610, 820, true);
在正面:
echo wp_get_attachment_image_url($imgID, 'about-us-slider-image');
但仅显示原始大小。原始图像大于该尺寸,我还尝试了再生缩略图。
怪异的部分是,在服务器上,所有裁剪大小都是可见的,但在var_dump()或其他任何地方都不可见。
I'm trying to display custom cropped thumbnails in Wordpress.
Here is my code:
add_image_size('about-us-slider-image', 610, 820, true);
And in the front:
echo wp_get_attachment_image_url($imgID, 'about-us-slider-image');
But only original size is shown. Original image is larger than this dimensions and I also tried regenerating thumbnails.
The weird part is that on the server all cropped sizes are visible but not in var_dump() or anywhere else.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在function.php中添加此代码后,您必须再生缩略图,然后将其显示为您的尺寸。您必须使用此插件再生。
https://wordpress.org/plugins/regenerate-regenerate-thumbnails-thumbnails-Advanced/
You have to regenerate the thumbnail after you added this code in function.php then after that it will appear like what you put the size. You have to regenerate by using this plugin.
https://wordpress.org/plugins/regenerate-thumbnails-advanced/