Snippets: 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 );

Snippet Type: PHP

Posted Under: Top Bar

All PHP snippets should be added via a child theme's functions.php file.