Skip to content

Snippet: Topbar Custom Image Icons

Important: This functionality has been deprecated completely! Images load slowly so it's best to use the built-in font icons or if you need custom images to use SVG's.

By default the topbar uses font icons for the social links. If you want you can easily use image icons instead. Simply go to the Customizer and change the style to Colored Image Icons (legacy) then you can use the snippet below to define your custom location for your images. In order for it to work your images must be png's and their names must match the "keys" defined in the 'wpex_topbar_social_options' array located in Total/framework/arrays.php. For example your twitter image must be twitter.php and your facebook icon must be facebook.png. To use other prefixes you would have to instead modify the file at partials/topbar/topbar-social.php via a child theme.

function my_alter_top_bar_social_img_url() {
	return get_stylesheet_directory_uri() .'/images/social/'; // Adjust accordingly.
add_filter( 'top_bar_social_img_url', 'my_alter_top_bar_social_img_url' );
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