1
我使用下面的代码,使用户能够上传自定义徽标为我的wordpress主题定制标志:add_image_size在WordPress的
function mytheme_setup() {
add_theme_support('custom-logo');
}
add_action('after_setup_theme', 'mytheme_setup');
我曾尝试推行add_image_size
与此呈现徽标180x180px:
add_image_size('mytheme-logo', 180, 180);
add_theme_support('custom-logo', array(
'size' => 'mytheme-logo'
));
要显示在我的主题标志,我已经使用:
<?php
// Display the Custom Logo
the_custom_logo('mytheme-logo');
// No Custom Logo, just display the site's name
if (!has_custom_logo()) {
?>
<h1 style="text-align:center;"><?php bloginfo('name'); ?></h1>
<?php
}
?>
因此,我现在可以上传并显示徽标,但似乎图像不受add_image_size
的影响。图像不会被wordrpress调整大小,这是一个问题,因为它可能会影响网站的加载时间。
我在这里做错了什么?
谢谢。这是要调整图像的大小还是只是将标记追加到输出? – Arete
它应该确实调整图像为你:) –
这不适合我...我可以选择一个标志,但它保持巨大(不调整到180x180) – Bassie