首页 > 解决方案 > 在functions.php Word Press中添加主题支持后,自定义徽标按钮不出现

问题描述

我正在按照教程为 Word Press 创建自定义主题。我正在尝试添加自定义徽标主题支持,但按钮未出现在 Word Press 面板中。

function fja_theme_support()
{
    add_theme_support('custom-logo');
}
add_action('after_theme_setup', 'fja_theme_support);

这是我的 word press 管理面板

标签: wordpresswordpress-theming

解决方案


这是主题开发人员手册中的一个示例

Hook 应该被命名after_setup_theme,提供一系列额外的设置 - 你可以在这里找到它们

function themename_custom_logo_setup() {
    $defaults = array(
        'height'               => 100,
        'width'                => 400,
        'flex-height'          => true,
        'flex-width'           => true,
        'header-text'          => array( 'site-title', 'site-description' ),
        'unlink-homepage-logo' => true, 
    );
 
    add_theme_support( 'custom-logo', $defaults );
}
 
add_action( 'after_setup_theme', 'themename_custom_logo_setup' );

推荐阅读