WPDIR
Everything and everyone WordPress

cleanest way to add custom logo to WordPress theme customizer?

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #535 Reply
    Ruth
    Guest

    The official way adds a lot of junk HTML markup and wrappers, what is the cleaner way to just get the custom_logo image URL via PHP snippet? The only example I found was this, which is still not very clean

    Add a Dynamic Custom Logo to a WordPress Theme

    #536 Reply
    Louis
    Guest
    <?php
    $custom_logo_id = get_theme_mod( 'custom_logo' );
    $logo = wp_get_attachment_image_src( $custom_logo_id , 'full' );
    if ( has_custom_logo() ) {
            echo '' . get_bloginfo( 'name' ) . '';
    } else {
            echo '<h1>'. get_bloginfo( 'name' ) .'</h1>';
    }
    ?>

    from the article post

Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: cleanest way to add custom logo to WordPress theme customizer?