DIVI, how to add an SVG logo

  1. At first, you must add a snippet to functions.php, in order to allow WordPress to upload SVG files in Media:
/* Add SVG to media types */
function cc_mime_types( $mimes ){
 $mimes['svg'] = 'image/svg+xml';
 return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );

2. Then you must the code below, to theme-header.php to replace the <img> tag with the <object> tag, so you must find this piece of code (for me it was about line #214):

<!-- Code to be removed -->
<img src="<?php echo esc_attr( $logo ); ?>" alt="<?php echo esc_attr( get_bloginfo( 'name' ) ); ?>" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" />

and add this code:

<object type="image/svg+xml" id="logo" data-height-percentage="<?php echo esc_attr( et_get_option( 'logo_height', '54' ) ); ?>" data="<?php echo esc_attr( $logo ); ?>" > <div class="logo_fall">Your Divi Logo</div>   
                    </object>
Scroll to Top