| @@ -40,13 +40,9 @@ | ||
| 40 | 40 | 'navPrevIcon' => 'arrowLeft', |
| 41 | 41 | 'navNextIcon' => 'arrowRight', |
| 42 | 42 | 'customPrevSVG' => '', |
| 43 | 43 | 'customNextSVG' => '', |
| 44 | - 'excerptLength' => 20, | |
| 45 | - 'enableRemoteNav' => false, | |
| 46 | - 'remotePrevSelector' => '', | |
| 47 | - 'remoteNextSelector' => '', | |
| 48 | - 'detachContent' => false, // New attribute for detaching content | |
| 44 | + 'excerptLength' => 20 | |
| 49 | 45 | ]; |
| 50 | 46 | |
| 51 | 47 | $atts = wp_parse_args( $attributes, $defaults ); |
| 52 | 48 | |
| @@ -73,21 +69,10 @@ | ||
| 73 | 69 | 'swiper-slide', |
| 74 | 70 | $atts['sliderType'] === 'slider' ? 'slide-mode' : '' |
| 75 | 71 | ]; |
| 76 | 72 | |
| 77 | - if ( ! empty( $atts['detachContent'] ) ) { | |
| 78 | - $swiper_classes[] = 'detach-content'; | |
| 79 | - } | |
| 80 | - | |
| 81 | 73 | ?> |
| 82 | - <div <?php echo wp_kses_post( $block_props ); ?> data-swiper-options="<?php echo esc_attr( wp_json_encode( $atts['sliderOptions'] ) ); ?>" | |
| 83 | - <?php | |
| 84 | - if ( $atts['enableRemoteNav'] ) { | |
| 85 | - echo 'data-rprev="' . esc_attr( $atts['remotePrevSelector'] ) . '" '; | |
| 86 | - echo 'data-rnext="' . esc_attr( $atts['remoteNextSelector'] ) . '" '; | |
| 87 | - } | |
| 88 | - ?> | |
| 89 | - > | |
| 74 | + <div <?php echo wp_kses_post( $block_props ); ?> data-swiper-options="<?php echo esc_attr( wp_json_encode( $atts['sliderOptions'] ) ); ?>"> | |
| 90 | 75 | <div class="swiper"> |
| 91 | 76 | <div class="swiper-wrapper"> |
| 92 | 77 | <?php |
| 93 | 78 | if ( is_array( $atts['queryPosts'] ) && ! empty( $atts['queryPosts'] ) ) { |
| @@ -106,35 +91,15 @@ | ||
| 106 | 91 | : 'background-position: center center;'; |
| 107 | 92 | $bg_style = $post_image ? sprintf( 'background-image: url(%s); %s', esc_url( $post_image ), $bg_position ) : $bg_position; |
| 108 | 93 | $post_categories = isset( $post['categories'] ) ? $post['categories'] : []; |
| 109 | 94 | |
| 110 | - // create object-position style | |
| 111 | - $object_position = isset( $focusPoints[$index - 1] ) && isset( $focusPoints[$index - 1]['x'] ) && isset( $focusPoints[$index - 1]['y'] ) | |
| 112 | - ? sprintf( 'object-position: %d%% %d%%;', round( $focusPoints[$index - 1]['x'] * 100 ), round( $focusPoints[$index - 1]['y'] * 100 ) ) | |
| 113 | - : 'object-position: center center;'; | |
| 114 | - | |
| 115 | 95 | ?> |
| 116 | 96 | <div class="<?php echo esc_attr( implode( ' ', $swiper_classes ) ); ?>"> |
| 117 | - <div class="swiper-container-outer" | |
| 118 | - <?php if ( ! $atts['detachContent'] ) : ?> | |
| 119 | - style="<?php echo esc_attr( $bg_style ); ?>" | |
| 120 | - <?php endif; ?> | |
| 121 | - > | |
| 97 | + <div class="swiper-container-outer" style="<?php echo esc_attr( $bg_style ); ?>"> | |
| 122 | 98 | <?php if ( $atts['enableOverlay'] ) : ?> |
| 123 | 99 | <div class="gutslider-overlay"></div> |
| 124 | 100 | <?php endif; ?> |
| 125 | - <?php | |
| 126 | - if ( $atts['detachContent'] && $post_image ) { | |
| 127 | - ?> | |
| 128 | - <a class="detached-featured-image" href="<?php echo esc_url( $post_link ); ?>"> | |
| 129 | - <img src="<?php echo esc_url( $post_image ); ?>" alt="<?php echo esc_attr( $post_title ); ?>" | |
| 130 | - style="<?php echo esc_attr( $object_position ); ?>" | |
| 131 | - /> | |
| 132 | - </a> | |
| 133 | - <?php | |
| 134 | - } | |
| 135 | - ?> | |
| 136 | - <div class="gutslider-content-wrapper<?php echo $atts['detachContent'] ? ' detach-content' : ''; ?>"> | |
| 101 | + <div class="gutslider-content-wrapper"> | |
| 137 | 102 | <div class="gutslider-content-inner"> |
| 138 | 103 | <?php if ( $atts['showCat'] ) : ?> |
| 139 | 104 | <div class="post-categories <?php echo esc_attr( $atts['catAnimation'] ); ?>"> |
| 140 | 105 | <?php |
| @@ -197,9 +162,9 @@ | ||
| 197 | 162 | } |
| 198 | 163 | ?> |
| 199 | 164 | </div> |
| 200 | 165 | <?php |
| 201 | - if( $atts['showNavigation'] === '1' && $atts['navContainerPosition'] === 'nav_inside' && $atts['enableRemoteNav'] !== '1' ) { | |
| 166 | + if( $atts['showNavigation'] === '1' && $atts['navContainerPosition'] === 'nav_inside' ) { | |
| 202 | 167 | ?> |
| 203 | 168 | <div class="gutslider-nav nav_inside <?php echo esc_attr( $atts['navPosition'] ); ?>"> |
| 204 | 169 | <?php if ( $atts['customNavIcon'] ) : ?> |
| 205 | 170 | <div class="gutslider-prev"> |
| @@ -240,9 +205,9 @@ | ||
| 240 | 205 | } |
| 241 | 206 | ?> |
| 242 | 207 | </div> |
| 243 | 208 | <?php |
| 244 | - if ( $atts['showNavigation'] === '1' && $atts['navContainerPosition'] === 'nav_outside' && $atts['enableRemoteNav'] !== '1' ) : ?> | |
| 209 | + if ( $atts['showNavigation'] === '1' && $atts['navContainerPosition'] === 'nav_outside' ) : ?> | |
| 245 | 210 | <div class="gutslider-nav nav_outside <?php echo esc_attr( $atts['navPosition'] ); ?>"> |
| 246 | 211 | <?php if ( $atts['customNavIcon'] ) : ?> |
| 247 | 212 | <div class="gutslider-prev"> |
| 248 | 213 | <!-- <div class="gutslider-prev-icon"> --> |