1

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

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

谢谢!

4

1 回答 1

3

如果我理解你想要做什么,我想你可以看看主题的functions.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 页面中看到的那样

我希望这就是您想要的,如果不是,请告诉我;)

于 2012-04-20T07:19:08.400 回答