<span class="resolved" aria-label="Resolved" title="Topic is resolved."></span>Fix proposal to support all themes.

[ad_1]

Replies: 1

On inc/enqueue.php change to ‘-script’ instead of ‘-style’ because it is a script and not a style (twenty20-script and twenty20-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);

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer