Shortcodes inside Theme's Social Links

Been trying to figure out this on my own but I hit the wall … I am using ACF to manage global site info like email, telephone, address, hours, etc… and since BB theme’s social links only work at the header and footer of the theme and not the body nor widgets I thought of using ACF shortcodes as they work perfect in inside the body, also it works great inside text elements of the theme’s customizer but not inside the widgets, but with a small line of code I got them to work inside the widgets, the only thing missing is the theme’s social icons so I can just add/edit them at one single point and affect the links on all pages and the theme as well…

With this code, shortcodes now work inside widgets
add_filter('widget_text', 'do_shortcode');

What’s the ID to get them to work inside the social links?

This is my shortcode for the Facebook link:
[acf field='facebook' post_id='option']

So by doing this I can now manage these links for the entire site (theme, widgets and content) But I need to get the theme’s social links to accept shortcodes. Please advise.

BTW, the “icons group” module works perfect with this method because it’s inside the body. I am guessing that by adding the right ID my line of code it’ll work inside the theme’s social icons too… something like :

add_filter('fl_social_icons', 'do_shortcode');
???

Anyone?

Hey Carlos,

Just letting you know we’re checking in on this one. :slight_smile:

Ben

Hi Carlos,

There currently isn’t any way to filter the social icon links (and most Customizer settings) in the way you are looking for, but we can add one in the next release.

For now, go ahead and change line 226 of class-fl-customizer.php to this…

return apply_filters( 'fl_theme_mods', $mods );

You can then use that like this (untested)…

function my_theme_mods_do_shortcode( $mods ) {
	
	foreach( $mods as $mod_key => $mod_value ) {
		$mods[ $mod_key ] = do_shortcode( $mod_value );
	}
	
	return $mods;
}

add_filter( 'fl_theme_mods', 'my_theme_mods_do_shortcode' );

Give that a shot and let me know how it goes!

Justin

IT WORKS! Just one more question, is this going to be added in the next theme release for sure? should I leave this edit in the main BB theme ? or should I add this file to the child theme? I usually don’t like overriding core theme files because I want to always stay up to date with new improvements, so please let me know!

Appreciate your help big time! on April 18 it’ll be the end of my first year using BB agency plugin and I’ve seen it come a long way, I am very excited about renewing for a second year because honestly, the plugin/theme features are great but the support I always get sets you apart from most of the other premium service I am subscribed to. I used to hard-code my sites entirely before learning about beaver builder because I hated templates! I have built over 50 sites with it and they all stand on beaver builder.

Thank you very much!

This works real nice! If the shortcode returns empty, the social icon won’t be displayed. Awesome!!!

Hi Carlos,

Happy to hear your issue has been resolved and thanks for informing us.

Thanks,
Danny

Hey Carlos,

Thanks for the kind words!

Just one more question, is this going to be added in the next theme release for sure? should I leave this edit in the main BB theme ?

Yes, this change has been committed so it will be in the next release. You can leave it in the theme for now.

Justin

Great ! I am leaving it in the actual theme! Thank you very much! Appreciate your help!