WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #25280, comment 16


Ignore:
Timestamp:
05/07/2014 05:47:03 PM (5 years ago)
Author:
adamsilverstein
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25280, comment 16

    initial v1  
    22
    33I added the following code to my template:
    4 ```
    5 wp_enqueue_script( 'localize_test', get_template_directory_uri() . '/localize_script.js', array(), '1.0.0', true );
     4{{{
     5wp_enqueue_script( 'localize_test', get_template_directory_uri() . '/localize_script.js', array(), '1.0.0', true ); 
    66        $array_to_localize = array(
    77                'a_string'  => __( 'Some String' ),
     
    1010                'f_boolean' => false,
    1111                );
     12wp_localize_script( 'localize_test', 'localized_variable', $array_to_localize );
     13}}}
    1214
    13 wp_localize_script( 'localize_test', 'localized_variable', $array_to_localize );
    14 ```
    15 
    16 the created a localize_script.js file with the single line ```console.log( localized_variable );```
     15the created a localize_script.js file with the single line {{{console.log( localized_variable );}}}
    1716
    1817result was as expected: