我已经通过外观->自定义将网站的横幅图像设置为可自定义。
我想调整自定义程序的图像大小和裁剪纵横比,因为它仍然设置为缩略图正方形,150px x x 150px,横幅图像变得模糊。这可能吗?
这是函数中的代码。php
function tyc_banner_image($wp_customize) {
$wp_customize->add_section(\'tyc_banner_image-section\', array(
\'title\' => \'Banner Image\'
));
$wp_customize->add_setting(\'tyc_banner_image-display\', array(
\'default\' => \'No\'
));
$wp_customize->add_setting(\'tyc_banner_image-image\');
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control($wp_customize, \'tyc_banner_image-control\', array(
\'label\' => \'Image\',
\'section\' => \'tyc_banner_image-section\',
\'settings\' => \'tyc_banner_image-image\',
)));
}
add_action(\'customize_register\', \'tyc_banner_image\');
SO网友:JakePowell
事实证明,这很简单,只是知道要搜索什么
https://codex.wordpress.org/Class_Reference/WP_Customize_Manager
在我的tyc\\u banner\\u image函数中,我添加了下面的最后四个参数。
$wp_customize->add_control( new WP_Customize_Cropped_Image_Control($wp_customize, \'tyc_banner_image-control\', array(
\'label\' => \'Image\',
\'section\' => \'tyc_banner_image-section\',
\'settings\' => \'tyc_banner_image-image\',
\'flex_width\' => true,
\'flex_height\' => true,
\'width\' => 1920,
\'height\' => 500,
)));