0

我基于经典的二十一主题创建了一个 wordpress 主题。我在 functions.php 中更改了标题图像的大小,但除此之外,我并没有弄乱自定义标题的东西。现在,当我将特色图像分配给页面时,wordpress 会忽略它,而只显示在标题设置中选择的背景。图像的大小似乎与问题无关。我尝试使用精确的图像尺寸和更大的图像,它们总是被忽略......

谢谢,如果你能帮忙!

PS。这里是网站的链接:http: //stuck-mueller.de/beta/

这是来自functions.php的代码:

// The custom header business starts here.

$custom_header_support = array(
    // The default image to use.
    // The %s is a placeholder for the theme template directory URI.
    'default-image' => '%s/images/headers/path.jpg',
    // The height and width of our custom header.
    'width' => apply_filters( 'twentyten_header_image_width', 960 ),
    'height' => apply_filters( 'twentyten_header_image_height', 240 ),
    // Support flexible heights.
    'flex-height' => true,
    // Don't support text inside the header image.
    'header-text' => false,
    // Callback for styling the header preview in the admin.
    'admin-head-callback' => 'twentyten_admin_header_style',
);

add_theme_support( 'custom-header', $custom_header_support );

if ( ! function_exists( 'get_custom_header' ) ) {
    // This is all for compatibility with versions of WordPress prior to 3.4.
    define( 'HEADER_TEXTCOLOR', '' );
    define( 'NO_HEADER_TEXT', true );
    define( 'HEADER_IMAGE', $custom_header_support['default-image'] );
    define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] );
    define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] );
    add_custom_image_header( '', $custom_header_support['admin-head-callback']   );
    add_custom_background();
}

// We'll be using post thumbnails for custom header images on posts and pages.
// We want them to be 940 pixels wide by 198 pixels tall.
// Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true );
4

1 回答 1

0

您不需要 apply_filters() 只需将宽度和高度分配给整数,例如:

'width' => 960,
'height' => 240,

在此处查看法典以获取更多信息

于 2013-07-26T20:48:17.350 回答