Changeset 11590 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php
- Timestamp:
- 02/22/2022 03:06:29 AM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-openverse/functions.php
r11217 r11590 2 2 3 3 namespace WordPressdotorg\Openverse\Theme; 4 5 use function WordPressdotorg\Locales\get_locales; 4 6 5 7 /** … … 84 86 /* in_footer */ true 85 87 ); 88 89 $use_path_based_locale_forwarding = get_theme_mod( 'ov_path_based_i18n', false ); 90 $wp_locale = get_locale(); 91 $locale = get_locales()[ $wp_locale ]; 92 $locale_slug = $use_path_based_locale_forwarding && $wp_locale !== 'en_US' ? $locale->slug : ''; 93 86 94 wp_add_inline_script( 87 95 /* handle */ 'openverse-message', 88 96 /* JS */ 'const openverseUrl = ' . wp_json_encode( get_theme_mod( 'ov_src_url', OPENVERSE_URL ) ) . ";\n" . 89 97 /* JS */ 'const openverseSubpath = ' . wp_json_encode( OPENVERSE_SUBPATH ) . ";\n" . 90 /* JS */ 'const currentLocale = ' . wp_json_encode( get_locale() ) . ";\n", 98 /* JS */ 'const currentLocale = ' . wp_json_encode( $wp_locale ) . ";\n" . /* Used for legacy cookie based locale forwarding */ 99 /* JS */ 'const localeSlug = ' . wp_json_encode( $locale_slug ) . ";\n", 91 100 /* position */ 'before' 92 ); 101 ); 93 102 94 103 wp_enqueue_script( … … 161 170 ) 162 171 ) ); 172 173 $wp_customize->add_setting( 'ov_path_based_i18n', array( 174 'type' => 'theme_mod', 175 'capability' => 'edit_theme_options', 176 'default' => false 177 ) ); 178 179 $wp_customize->add_control( 'ov_path_based_i18n', array( 180 'section' => 'ov_embed', 181 'type' => 'checkbox', 182 'id' => 'ov_path_based_i18n', 183 'label' => 'Use path based locale forwarding', 184 'priority' => 10 185 ) ); 163 186 } 164 187 add_action( 'customize_register', __NAMESPACE__ . '\wporg_ov_customizer' );
Note: See TracChangeset
for help on using the changeset viewer.