Skip to content

Snippet: Use an SVG for your site logo

Important: You can set an SVG icon via the Customizer and it will display on the site using an img tag, this snippet is if you want to display the logo using an SVG tag instead. And if you override the logo html with your custom SVG certain functions will no longer work such as the custom sticky logo or custom per-page logo options. So you should only use this function if you want to insert an SVG logo into your logo area and display it at all times.

This snippet will allow you to override the default theme logo with a custom SVG icon.

 * Override logo with custom SVG.
 * @link
add_filter( 'totaltheme/header/logo', function( $output ) {
    return 'your custom svg code';
} );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top