我试图在wordpress自定义中创建一个数组。php我确实在函数中使用了wp\\u localize\\u脚本。php如下
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\' );
在脚本中。js我正在尝试使用此
scrollorama.animate(\'.para-welcome\',{
delay: 200, duration: 300, property:\'var para = effect.zoom;\', start:0
});
我的设置和控件是
$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\',
)
) );
但它还不起作用,我使用了我找到的所有解决方案,但没有任何更改,我需要添加选择菜单来更改任何部分的视差效果,请任何人帮忙