WordPress.org

Forums

How to use wp_localize_script (2 posts)

  1. afrila gunadi
    Member
    Posted 1 year ago #

    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>

    <?php
    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('.callbacks_nav').hide();
    
    	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
          jQuery(".pic_slider").responsiveSlides({
            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>");
            }
          });
        });
    
    });
    </script>

    please help me, thx before :)
    regards

  2. afrila gunadi
    Member
    Posted 1 year ago #

    anyone can help me?

    thx before :)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.