Skip to content

Snippet: Custom Topbar Social Link for Another Language (WPML)

add_action( 'after_setup_theme', function() {

	// Get global Customizer settings
	global $wpex_theme_mods;

	// Check if topbar facebook value is set
	if ( isset( $wpex_theme_mods['top_bar_social_profiles']['facebook'] ) ) {

		// Get current language
		$current_language = defined( 'ICL_LANGUAGE_CODE' ) ? ICL_LANGUAGE_CODE : '';

		// Update global variable to alter the value of the topbar social facebook link for this language
		if ( 'he' == $current_language ) {
			$wpex_theme_mods['top_bar_social_profiles']['facebook'] = 'HEBREW FACEBOOK PAGE';
		}

	}

}, 40 );
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