禁用 WordPress 自定义标题图像上的纵横比或图像裁剪


Disable aspect ratio or image crop on wordpress custom header images

谁能帮我禁用wordpress 2011主题中自定义标题图像裁剪的纵横比,或者完全禁用裁剪?

在这个阶段,我只需要完成它,即使这意味着修改核心文件。我已经用谷歌搜索了解决方案,但到目前为止还没有找到。

谢谢!

如果我很好地理解你想做什么,我想你可以看看主题的功能.php文件。

您将看到这些行:

// The height and width of your custom header.
// Add a filter to twentyeleven_header_image_width and twentyeleven_header_image_height to change these values.
define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyeleven_header_image_width', 1000 ) );
define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyeleven_header_image_height', 288 ) );
// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be the size of the header image that we just defined
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
// Add Twenty Eleven's custom image sizes
add_image_size( 'large-feature', HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); // Used for large feature (header) images
add_image_size( 'small-feature', 500, 300 ); // Used for featured posts if a large-feature doesn't exist

如果要更改裁剪的行为,只需将 *add_image_size()* 函数的第三个参数设置为 false,如 add_image_size() codex 页面所示

我希望这就是你想要的,如果没有,请告诉我;)