get_site_icon_url example


function do_favicon() {
    /** * Fires when serving the favicon.ico file. * * @since 5.4.0 */
    do_action( 'do_faviconico' );

    wp_redirect( get_site_icon_url( 32, includes_url( 'images/w-logo-blue-white-bg.png' ) ) );
    exit;
}

/** * Determines whether WordPress is already installed. * * The cache will be checked first. If you have a cache plugin, which saves * the cache values, then this will work. If you use the default WordPress * cache, and the database goes away, then you might have problems. * * Checks for the 'siteurl' option for whether WordPress is installed. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 2.1.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @return bool Whether the site is already installed. */
/** * Displays the Site Icon URL. * * @since 4.3.0 * * @param int $size Optional. Size of the site icon. Default 512 (pixels). * @param string $url Optional. Fallback url if no site icon is found. Default empty. * @param int $blog_id Optional. ID of the blog to get the site icon for. Default current blog. */
function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
    echo esc_url( get_site_icon_url( $size$url$blog_id ) );
}

/** * Determines whether the site has a Site Icon. * * @since 4.3.0 * * @param int $blog_id Optional. ID of the blog in question. Default current blog. * @return bool Whether the site has a site icon or not. */
function has_site_icon( $blog_id = 0 ) {
    

}

/** * Displays Site Icon in atom feeds. * * @since 4.3.0 * * @see get_site_icon_url() */
function atom_site_icon() {
    $url = get_site_icon_url( 32 );
    if ( $url ) {
        echo '<icon>' . convert_chars( $url ) . "</icon>\n";
    }
}

/** * Displays Site Icon in RSS2. * * @since 4.3.0 */
function rss2_site_icon() {
    

    $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;

        if ( ! $blogname ) {
            $blogname = preg_replace( '#^(https?://)?(www.)?#', '', get_home_url() );
        }

    protected function add_site_icon_to_index( WP_REST_Response $response ) {
        $site_icon_id = get_option( 'site_icon', 0 );

        $this->add_image_to_index( $response$site_icon_id, 'site_icon' );

        $response->data['site_icon_url'] = get_site_icon_url();
    }

    /** * Exposes an image through the WordPress REST API. * This is used for fetching this information when user has no rights * to update settings. * * @since 5.9.0 * * @param WP_REST_Response $response REST API response. * @param int $image_id Image attachment ID. * @param string $type Type of Image. */


/** * Prints the necessary markup for the site title in an embed template. * * @since 4.5.0 */
function the_embed_site_title() {
    $site_title = sprintf(
        '<a href="%s" target="_top"><img src="%s" srcset="%s 2x" width="32" height="32" alt="" class="wp-embed-site-icon" /><span>%s</span></a>',
        esc_url( home_url() ),
        esc_url( get_site_icon_url( 32, includes_url( 'images/w-logo-blue.png' ) ) ),
        esc_url( get_site_icon_url( 64, includes_url( 'images/w-logo-blue.png' ) ) ),
        esc_html( get_bloginfo( 'name' ) )
    );

    $site_title = '<div class="wp-embed-site-title">' . $site_title . '</div>';

    /** * Filters the site title HTML in the embed footer. * * @since 4.4.0 * * @param string $site_title The site title HTML. */
Home | Imprint | This part of the site doesn't use cookies.