has_site_icon example

<?php }

/** * Displays site icon meta tags. * * @since 4.3.0 * * @link https://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon. */
function wp_site_icon() {
    if ( ! has_site_icon() && ! is_customize_preview() ) {
        return;
    }

    $meta_tags = array();
    $icon_32   = get_site_icon_url( 32 );
    if ( empty( $icon_32 ) && is_customize_preview() ) {
        $icon_32 = '/favicon.ico'; // Serve default favicon URL in customizer so element can be updated for preview.     }
    if ( $icon_32 ) {
        $meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( $icon_32 ) );
    }
    

    $show_site_icons = apply_filters( 'wp_admin_bar_show_site_icons', true );

    foreach ( (array) $wp_admin_bar->user->blogs as $blog ) {
        switch_to_blog( $blog->userblog_id );

        if ( true === $show_site_icons && has_site_icon() ) {
            $blavatar = sprintf(
                '<img class="blavatar" src="%s" srcset="%s 2x" alt="" width="16" height="16"%s />',
                esc_url( get_site_icon_url( 16 ) ),
                esc_url( get_site_icon_url( 32 ) ),
                ( wp_lazy_loading_enabled( 'img', 'site_icon_in_toolbar' ) ? ' loading="lazy"' : '' )
            );
        } else {
            $blavatar = '<div class="blavatar"></div>';
        }

        $blogname = $blog->blogname;

        
Home | Imprint | This part of the site doesn't use cookies.