How to change the wordpress default logo from the Admin?

后端 未结 5 473
-上瘾入骨i
-上瘾入骨i 2020-12-19 21:20

\"Wordpress

I want to create a custom logo so I need change the default logo of the wordpress logo.

相关标签:
5条回答
  • 2020-12-19 21:34

    I did few arrangement:
    - support the fullscreen mode
    - use the favicon of the site so it is automatically customized for multisites, and you can put some default image if there is no favicon)
    I put "width: 12px" to have a square shape for the favicon cover background
    If it can help someone here is the code :

    function my_custom_admin_logo() {
        echo '
            <style type="text/css">
                #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon:before {content:none;}
                #wpadminbar #wp-admin-bar-wp-logo > a {
                    background-image: url(' . get_site_icon_url() . ') !important;
                    background-size: cover !important;
                }
                #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {width: 12px;}
                @media screen and (max-width:782px){ #wpadminbar #wp-admin-bar-wp-logo > .ab-item .ab-icon {width: 46px;} }
                a.edit-post-fullscreen-mode-close.has-icon {
                    background-image: url(' . get_site_icon_url() . ');
                    background-size: cover;
                }
                .edit-post-fullscreen-mode-close.has-icon > svg > path { display: none;}
            </style>
        ';
    }
    //hook into the administrative header output
    add_action('wp_before_admin_bar_render', 'my_custom_admin_logo');
    
    0 讨论(0)
  • 2020-12-19 21:43

    Change your dashboard logo to custom logo with this code:

    add_action('admin_head', 'my_custom_logo');
    
    function my_custom_logo() {
    echo '
    <style type="text/css">
    #header-logo { background-image: url('.get_bloginfo('template_directory').'/images/custom-logo.gif) !important; }
    </style>
    ';
    }
    
    0 讨论(0)
  • 2020-12-19 21:44
    function my_login_logo() { ?>
    <style type="text/css">
        body.login div#login h1 a {
            background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/site-login-logo.png);
            padding-bottom: 30px;
        }
    </style>
    

    0 讨论(0)
  • 2020-12-19 21:53

    Here is a great plugin for this, and much more. White Label CMS

    0 讨论(0)
  • 2020-12-19 21:54

    Here is the function (inserted into functions.php) which will correctly override the admin logo:

    /**
    * customize the admin logo that appears in the header
    * http://www.wpbeginner.com/wp-themes/adding-a-custom-dashboard-logo-in-wordpress-for-       branding/
    * @author Paul Bredenberg
    */
    
    function htx_custom_logo() {
    echo '
    <style type="text/css">
    #wp-admin-bar-wp-logo > .ab-item .ab-icon { 
    background-image: url(' . get_bloginfo('stylesheet_directory') . '/assets/images/dashboard-logo.png) !important; 
    background-position: 0 0;
    }
    #wpadminbar #wp-admin-bar-wp-logo.hover > .ab-item .ab-icon {
    background-position: 0 0;
    }   
     </style>
    ';
    }
    
     //hook into the administrative header output
    add_action('admin_head', 'htx_custom_logo');
    

    Take from Here: http://goo.gl/GuDZM6

    HTH!

    0 讨论(0)
提交回复
热议问题