Fix proposal to support all themes.
-
On
inc/enqueue.php
change to ‘-script’ instead of ‘-style’ because it is a script and not a style (twenty20-script
andtwenty20-eventmove-script
).function twenty20_zb_enqueue_script() {
// Twenty20 Script
wp_enqueue_script( 'twenty20-script', ZB_T20_URL . '/assets/js/jquery.twenty20.js', array( 'jquery' ), ZB_T20_VER, true );
// Twenty20 Event Move Script
wp_enqueue_script( 'twenty20-eventmove-script', ZB_T20_URL . '/assets/js/jquery.event.move.js', array( 'jquery' ), ZB_T20_VER, true );}
On
inc/twenty20-eventmove-script.php
include the script in the right way, to get it work with all themes.$script .= 'jQuery( document ).ready(function( $ ) {';
if($atts['direction'] == "vertical"){
$direc = "[data-orientation='vertical']";
$script .= '$(".twentytwenty-container.'.esc_js($t20ID). $direc . '").twentytwenty({default_offset_pct: ' . esc_js($atts['offset'] . $isHover) . $data_vertical . '});';
}else{
$direc = "[data-orientation!='vertical']";
$script .= '$(".twentytwenty-container.'.esc_js($t20ID).$direc.'").twentytwenty({default_offset_pct: '. esc_js($atts['offset'] . $isHover) .'});';
}
if($atts['before']){
$script .= '$(".' . twenty20_zb_sanitize_xss_offset( esc_js($t20ID) ) . ' .twentytwenty-before-label").html("'. twenty20_zb_sanitize_xss_offset(esc_js($atts['before'])) .'");';
}else{
$script .= '$(".' . twenty20_zb_sanitize_xss_offset( esc_js($t20ID) ) . ' .twentytwenty-overlay").hide();';
}
if($atts['after']){
$script .= '$(".' . twenty20_zb_sanitize_xss_offset( esc_js($t20ID) ) . ' .twentytwenty-after-label").html("'. twenty20_zb_sanitize_xss_offset(esc_js($atts['after'])) .'");';
}else{
$script .= '$(".' . twenty20_zb_sanitize_xss_offset( esc_js($t20ID) ) . ' .twentytwenty-overlay").hide();';
}
$script .= '});';
wp_add_inline_script( 'twenty20-script', $script);
- You must be logged in to reply to this topic.