Title: make an array in wordpress cusmization api
Last modified: August 18, 2017

---

# make an array in wordpress cusmization api

 *  [ramy](https://wordpress.org/support/users/dwwar/)
 * (@dwwar)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/make-an-array-in-wordpress-cusmization-api/)
 * i’m trying to make an array in wordpress customize.php i do used wp_localize_script
   in function.php as follow
 *     ```
           function mytheme_scripts() {
   
           wp_register_script('scripts', get_template_directory_uri() . '/assets/js/scripts.js', 'jquery');
   
           $my_array = array( 'zoom' => get_theme_mod('zoom'), 'letter-spacing' => 'letter-spacing', 'rotate'  => 'rotate', 'left' => 'left' );
           wp_localize_script( 'scripts', 'effect', $my_array );
   
           wp_enqueue_script('scripts');
       }
       add_action( 'wp_enqueue_scripts', 'mytheme_scripts' );
       ```
   
 * in scripts.js im trying to change the effect using this
 *     ```
       scrollorama.animate('.para-welcome',{
           delay: 200, duration: 300, property:'var para = effect.zoom;', start:0
       });
       ```
   
 * my settings and controls are
 *     ```
               $wp_customize->add_setting( 'parallax_effect' , array(
               'default'     => 'zoom',
               'transport'   => 'postMessage',
           ) );
   
           $wp_customize->add_control( 'parallax_effect', array(
               'label' => 'Parallax effect',
               'section'   => 'mytheme_welcome',
               'settings'  => 'parallax_effect',
               'type'      => 'select',
               'choices'    => array(
                   'zoom' => 'zoom',
                   'letter-spacing' => 'letter-spacing',
                   'rotate' => 'rotate',
                   'left' => 'left',
               ) 
           ) );
       ```
   
 * but it’s not working yet i used all solutions i found but no changes
    any way
   i need to add select menu to change parallax effects of any section can any one
   help please

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/make-an-array-in-wordpress-cusmization-api/#post-9423972)
 * I think your localized script assignments are listed before the script is loaded
   so that the script defaults take precedence. Check your page’s HTML source to
   confirm. It may just be a matter of reversing the order of localize and enqueue.
 * In any case, confirm the assignments have the correct values and they occur after
   the script is loaded. If all is correct, there’s a problem with the script itself.
   Check you browser console for errors and resolve any listed.
 * If the assignments are not correct, there’s a problem somewhere in PHP. Whatever
   the problem, do tests to reduce where the problem must lie. Continue doing so
   and you will eventually reduce the scope so much that the problem can be identified.
 *  Thread Starter [ramy](https://wordpress.org/support/users/dwwar/)
 * (@dwwar)
 * [8 years, 9 months ago](https://wordpress.org/support/topic/make-an-array-in-wordpress-cusmization-api/#post-9454051)
 * all i need now is to pass value from “control” to the “property” element in JavaScript
   
   some thing like get element by id from PHP file to JavaScript file
 * How can i do this?

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘make an array in wordpress cusmization api’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 2 replies
 * 2 participants
 * Last reply from: [ramy](https://wordpress.org/support/users/dwwar/)
 * Last activity: [8 years, 9 months ago](https://wordpress.org/support/topic/make-an-array-in-wordpress-cusmization-api/#post-9454051)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
