Support » How-To and Troubleshooting » How to use wp_localize_script

How to use wp_localize_script

  • hai, i’m amateur developer for wordpress.

    this is my case,

    I’m create a theme options to customize the slider, partly script file .js (for slides), I’ve overridden in header.php.

    current speed + my nav, i integration in theme options, my changes theme options it’s work, but fitting auto (auto slide). I replace false (in header.php), it doesn’t work. but fitting in its files .js I replace false, it’s work.

    I want to use wp_localize_script, but do not know how to use it. 🙁

    this is my code in header.php, after </head>

    global $data;
        $smof = of_get_options();
        $speed = $smof['speed'];
        $arrow = $smof['arrow'];
        $auto = $smof['auto'];
        <script type="text/javascript">
    jQuery(document).ready(function() {
            // ==================================================
    	// show / hide slider navigation
    	// ==================================================
    	jQuery('#slider').hover(function() {
    	jQuery('.callbacks_nav').stop().animate({opacity: 1}, 100);
    	}, function() {
    	jQuery('.callbacks_nav').stop().animate({opacity: 0});}, 100);
    	jQuery(function () {
          // Slideshow 4
            auto: false, <-- i want to change it.
            pager: false,
            nav: <?php echo $arrow; ?>, <-- i want to change it.
            speed: <?php echo $speed; ?>, <-- i want to change it.
            namespace: "callbacks",
            before: function () {
              jQuery('.events').append("<li>before event fired.</li>");
            after: function () {
              jQuery('.events').append("<li>after event fired.</li>");

    please help me, thx before 🙂

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘How to use wp_localize_script’ is closed to new replies.
Skip to toolbar