我在运行WP 4.5.3的网站上使用了213Child主题。我想将标题横幅尺寸更改为900x480。
我的twentythirteen-child/functions.php
:
<?php
add_action( \'wp_enqueue_scripts\', \'theme_enqueue_styles\' );
function theme_enqueue_styles() {
wp_enqueue_style( \'parent-style\', get_template_directory_uri() . \'/style.css\' );
}
// remove default action from Twenty Twelve
/*remove_action( \'after_setup_theme\', \'twentythirteen_custom_header_setup\' );*/
function twentythirteenchild_custom_header_setup() {
$args = array(
// Text color and image (empty to use none).
\'default-text-color\' => \'220e10\',
\'default-image\' => \'%s/images/headers/circle.png\',
// Set height and width, with a maximum value for the width.
\'height\' => 480,
\'width\' => 900,
// Callbacks for styling the header and the admin preview.
\'wp-head-callback\' => \'twentythirteen_header_style\',
\'admin-head-callback\' => \'twentythirteen_admin_header_style\',
\'admin-preview-callback\' => \'twentythirteen_admin_header_image\',
);
add_theme_support( \'custom-header\', $args );
}
add_action( \'after_setup_theme\', \'twentythirteenchild_custom_header_setup\', 11 );
remove_filter( \'HEADER_IMAGE_WIDTH\', \'twentyeleven_header_image_width\' );
remove_filter( \'HEADER_IMAGE_HEIGHT\', \'twentyeleven_header_image_height\' );
define( \'HEADER_IMAGE_WIDTH\', apply_filters( \'twentythirteen_header_image_width\', 900 ) );
define( \'HEADER_IMAGE_HEIGHT\', apply_filters( \'twentythirteen_header_image_height\', 480 ) );
它起作用了,但只是部分起作用。
添加900x480图像时,我获得:
这很好。按下裁剪图像或跳过裁剪时,我获得:
这一点都不好。
你能帮忙吗?
提前非常感谢!!