Skip to content

Snippet: Allow Shortcodes in Top Bar Social Settings

This code will allow shortcodes to be added to the topbar social links function.

// Filter the output to parse the href value and render the shortcode value
add_filter( 'totaltheme/topbar/social/link_attributes', function( $attrs ) {
	$attrs['href'] = do_shortcode( $attrs['href']);
	return $attrs;
} );
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