Plugin Directory

Changeset 2451722


Ignore:
Timestamp:
01/07/2021 08:34:58 AM (5 years ago)
Author:
bpluijms
Message:

Fixed bug with slider.

Location:
kiyoh-klantenvertellen
Files:
70 added
2 edited

Legend:

Unmodified
Added
Removed
  • kiyoh-klantenvertellen/trunk/includes/class-kiyoh-klantenvertellen-plugin.php

    r2430778 r2451722  
    113113        wp_register_style( KK_PLUGIN_ID.'_slider_style', KK_PLUGIN_DIR_URL.'assets/lightslider/css/lightslider.css' );
    114114        wp_register_script( KK_PLUGIN_ID.'_slider_script', KK_PLUGIN_DIR_URL.'assets/lightslider/js/lightslider.js', array('jquery') );
    115 
    116 
    117115    }
    118116
     
    128126        wp_register_script( KK_PLUGIN_ID.'_slider_script', KK_PLUGIN_DIR_URL.'assets/lightslider/js/lightslider.js', array('jquery') );
    129127    }
    130 
     128   
    131129    /**
    132130     * Translation text domain
     
    183181            wp_enqueue_style(KK_PLUGIN_ID.'_slider_style');
    184182            $options['random_id'] = wp_generate_password(12, false, false); // Needed for slider in case of multiple widgets / shortcodes
     183           
     184            $script = 'jQuery(document).ready(function($) {
     185                $("#slider-' . $options['random_id'] . ' .kk-reviews").lightSlider({
     186                    item: 1,
     187                    controls: false,
     188                    adaptiveHeight: true,'
     189                    .(isset($options['auto_slide']) && $options['auto_slide'] == 'yes' ? '
     190                    auto: true,
     191                    pause: '.apply_filters('kk_plugin_slider_auto_delay', 6000).',
     192                    loop: true' : false).'
     193                });
     194            });';
     195           
     196            wp_add_inline_script( KK_PLUGIN_ID.'_slider_script', $script, 'after' );
    185197        }
    186198
     
    10551067           
    10561068          //echo date('Y-m-d H:i',get_transient('kk_plugin_last_check')).'<br>';
    1057 
    1058           $mapped_data = json_decode(get_option("kk_plugin_mapped_data"),true);
    1059           return $mapped_data;
     1069         
     1070          $data=get_option("kk_plugin_mapped_data");
     1071          if(is_array($data)) {
     1072              return $data;
     1073          } else {
     1074            return json_decode($data,true);
     1075          }
    10601076         
    10611077        }
  • kiyoh-klantenvertellen/trunk/templates/slider.php

    r2411007 r2451722  
    1616defined( 'ABSPATH' ) || exit;
    1717?>
    18 <script type="text/javascript">
    19   jQuery(document).ready(function($) {
    20     $("#slider-<?php echo $options['random_id']; ?> .kk-reviews").lightSlider({
    21          item: 1,
    22          controls: false,
    23          adaptiveHeight: true,
    24          <?php if (isset($options['auto_slide']) && $options['auto_slide'] == 'yes'): ?>
    25          auto: true,
    26          pause: <?php echo apply_filters('kk_plugin_slider_auto_delay', 6000); ?>,
    27          loop: true,
    28          <?php endif; ?>
    29 
    30     });
    31   });
    32 </script>
    3318
    3419<div id="slider-<?php echo $options['random_id']; ?>" class="kk-reviews kk-layout-slider kk-stars-theme-<?php echo ((isset($options['stars_theme']) && !empty($options['stars_theme']))?$options['stars_theme']:'none'); ?> kk-stars-size-<?php echo ((isset($options['stars_size']) && !empty($options['stars_size']))?$options['stars_size']:'medium'); ?> <?php echo esc_attr($options['class']);?>" itemscope="itemscope" itemtype="https://schema.org/Organization">
Note: See TracChangeset for help on using the changeset viewer.