@@ -33,7 +33,7 @@ public function __construct() {
33
33
public function admin_styles () {
34
34
35
35
// Register admin styles
36
- wp_register_style ( 'wpm_language_switcher ' , wpm_asset_path ( 'styles/admin/admin.css ' ), array (), WPM_VERSION );
36
+ wp_enqueue_style ( 'wpm_language_switcher ' , wpm_asset_path ( 'styles/admin/admin.css ' ), array (), WPM_VERSION );
37
37
}
38
38
39
39
@@ -79,12 +79,10 @@ public function admin_scripts() {
79
79
wp_localize_script ( 'wpm_translator ' , 'wpm_translator_params ' , $ translator_params );
80
80
81
81
if ( 'customize ' === $ screen_id ) {
82
- wp_enqueue_style ( 'wpm_language_switcher ' );
83
82
wp_enqueue_script ( 'wpm_language_switcher_customizer ' );
84
- $ params = array (
85
- 'switcher ' => wpm_get_template_html ( 'language-switcher-customizer.php ' ),
86
- );
87
- wp_localize_script ( 'wpm_language_switcher_customizer ' , 'wpm_language_switcher_params ' , $ params );
83
+ add_action ('admin_print_footer_scripts ' , function () {
84
+ echo wpm_get_template_html ( 'language-switcher-customizer.php ' );
85
+ });
88
86
}
89
87
90
88
$ admin_pages_config = apply_filters ( 'wpm_admin_pages ' , $ config ['admin_pages ' ] );
@@ -122,20 +120,21 @@ public function admin_scripts() {
122
120
* Display language switcher for edit posts, taxonomies, options
123
121
*/
124
122
public function set_language_switcher () {
125
- wp_enqueue_style ( 'wpm_language_switcher ' );
126
123
wp_enqueue_script ( 'wpm_language_switcher ' );
127
- $ params = array (
128
- 'switcher ' => wpm_get_template_html ( 'language-switcher.php ' ),
129
- );
130
- wp_localize_script ( 'wpm_language_switcher ' , 'wpm_language_switcher_params ' , $ params );
124
+
131
125
add_action ('admin_head ' , function () {
132
126
?>
133
127
<style>
134
128
#wpbody-content .wrap {
135
129
padding-top: 37px;
130
+ position: relative;
136
131
}
137
132
</style>
138
133
<?php
139
134
});
135
+
136
+ add_action ('admin_print_footer_scripts ' , function () {
137
+ echo wpm_get_template_html ( 'language-switcher.php ' );
138
+ });
140
139
}
141
140
}
0 commit comments