wordpress忽略特色图片

时间:2013-05-03 08:34:31

标签: wordpress header twenty-ten-theme

我基于经典的二十世纪主题创建了一个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 );

1 个答案:

答案 0 :(得分:0)

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

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

Check out the codex here for more info