| @@ -24,8 +24,9 @@ | ||
| 24 | 24 | $options = []; |
| 25 | 25 | |
| 26 | 26 | $options[] = [ |
| 27 | 27 | 'value' => $post_name . '|all', |
| 28 | + /* translators: %s template */ | |
| 28 | 29 | 'label' => sprintf( __( 'All %s', 'ablocks' ), $post_label ), |
| 29 | 30 | ]; |
| 30 | 31 | |
| 31 | 32 | if ( 'pages' !== $post_key ) { |
| @@ -30,8 +31,9 @@ | ||
| 30 | 31 | |
| 31 | 32 | if ( 'pages' !== $post_key ) { |
| 32 | 33 | $options[] = [ |
| 33 | 34 | 'value' => $post_name . '|all|archive', |
| 35 | + /* translators: %s template */ | |
| 34 | 36 | 'label' => sprintf( __( 'All %s Archive', 'ablocks' ), $post_label ), |
| 35 | 37 | ]; |
| 36 | 38 | } |
| 37 | 39 | |
| @@ -40,8 +42,9 @@ | ||
| 40 | 42 | $tax_name = $taxonomy->name; |
| 41 | 43 | |
| 42 | 44 | $options[] = [ |
| 43 | 45 | 'value' => $post_name . '|all|taxarchive|' . $tax_name, |
| 46 | + /* translators: %s template */ | |
| 44 | 47 | 'label' => sprintf( __( 'All %s Archive', 'ablocks' ), $tax_label ), |
| 45 | 48 | ]; |
| 46 | 49 | } |
| 47 | 50 | |
| @@ -235,9 +238,8 @@ | ||
| 235 | 238 | 'header', |
| 236 | 239 | 'footer' |
| 237 | 240 | ]; |
| 238 | 241 | |
| 239 | - $CoreAssets = new CoreAssets(); | |
| 240 | 242 | $FileUpload = new FileUpload(); |
| 241 | 243 | foreach ( $template_types as $template_type ) { |
| 242 | 244 | $post_id = Helper::get_template_id( $template_type ); |
| 243 | 245 | if ( $post_id ) { |
| @@ -251,11 +253,14 @@ | ||
| 251 | 253 | } |
| 252 | 254 | $js_file_path = $FileUpload->get_file_path( $post_id . '.min.js' ); |
| 253 | 255 | if ( file_exists( $js_file_path ) ) { |
| 254 | 256 | $js_file_url = $FileUpload->get_file_url( $post_id . '.min.js' ); |
| 255 | - wp_enqueue_script( 'ablocks-blocks-' . $template_type . '-' . $post_id . '-combine-script', $js_file_url, array(), filemtime( $js_file_path ), true ); | |
| 256 | - wp_localize_script( 'ablocks-blocks-' . $template_type . '-' . $post_id . '-combine-script', 'ABlocksGlobal', $CoreAssets->get_localize_script_data() ); | |
| 257 | + // One shared ABlocksGlobal for the whole page: without this each | |
| 258 | + // template type (header/footer/single/archive) printed its own | |
| 259 | + // identical copy on top of the page combine script's. | |
| 260 | + wp_enqueue_script( 'ablocks-blocks-' . $template_type . '-' . $post_id . '-combine-script', $js_file_url, array( 'ablocks-globals' ), filemtime( $js_file_path ), true ); | |
| 261 | + CoreAssets::localize_globals_once(); | |
| 257 | 262 | } |
| 258 | 263 | } |
| 259 | - } | |
| 264 | + }//end foreach | |
| 260 | 265 | } |
| 261 | 266 | } |