← All changes
|
templates/elementor/general/grid/grid-layout2.php
+195
-194
2.1.11
→
1.1.4
View file →
| @@ -1,194 +1,195 @@ | ||
| 1 | -<?php | |
| 2 | -/** | |
| 3 | - * Template: Grid Layout 2. | |
| 4 | - * | |
| 5 | - * @package RadiusTheme\SB | |
| 6 | - */ | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * Template variables: | |
| 10 | - * | |
| 11 | - * @var $grid string | |
| 12 | - * @var $class string | |
| 13 | - * @var $p_id int | |
| 14 | - * @var $img_args array | |
| 15 | - * @var $p_link string | |
| 16 | - * @var $items array | |
| 17 | - * @var $rating_args array | |
| 18 | - * @var $add_to_cart string | |
| 19 | - * @var $title_tag string | |
| 20 | - * @var $hover_btn_text string | |
| 21 | - * @var $excerpt_limit string | |
| 22 | - * @var $excerpt string | |
| 23 | - * @var $title_class string | |
| 24 | - * @var $title_link bool | |
| 25 | - * @var $title string | |
| 26 | - * @var $badge_class string | |
| 27 | - * @var $action_btn_preset string | |
| 28 | - * @var $action_btn_position string | |
| 29 | - * @var $swatch_position string | |
| 30 | - * @var $swatch_type string | |
| 31 | - * @var $has_attributes bool | |
| 32 | - * @var $raw_settings array | |
| 33 | - */ | |
| 34 | - | |
| 35 | -use RadiusTheme\SB\Helpers\Fns; | |
| 36 | - | |
| 37 | -// Do not allow directly accessing this file. | |
| 38 | -if ( ! defined( 'ABSPATH' ) ) { | |
| 39 | - exit( 'This script cannot be accessed directly.' ); | |
| 40 | -} | |
| 41 | - | |
| 42 | -global $product; | |
| 43 | - | |
| 44 | -$classes = esc_attr( $grid ) . ' ' . esc_attr( $class ); | |
| 45 | -$swatch_title_class = $has_attributes && in_array( 'swatches', $items, true ) && 'title' === $swatch_position ? ' title-with-swatch' : ''; | |
| 46 | -$swatch_price_class = $has_attributes && in_array( 'swatches', $items, true ) && 'price' === $swatch_position ? ' price-with-swatch' : ''; | |
| 47 | -?> | |
| 48 | - | |
| 49 | -<div <?php wc_product_class( $classes, $product ); ?> data-id="<?php echo absint( $p_id ); ?>"> | |
| 50 | - <?php | |
| 51 | - /** | |
| 52 | - * Before product items hook. | |
| 53 | - */ | |
| 54 | - do_action( 'rtsb/before/shop/product/item' ); | |
| 55 | - ?> | |
| 56 | - | |
| 57 | - <div class="rtsb-grid-item"> | |
| 58 | - <div class="rtsb-product-img"> | |
| 59 | - <?php | |
| 60 | - /** | |
| 61 | - * Before product image hook. | |
| 62 | - */ | |
| 63 | - do_action( 'rtsb/before/shop/product/image' ); | |
| 64 | - | |
| 65 | - /** | |
| 66 | - * Product image hook. | |
| 67 | - * | |
| 68 | - * @hooked RadiusTheme\SB\Controllers\Hooks\ActionHooks::render_image 10 | |
| 69 | - */ | |
| 70 | - do_action( 'rtsb/shop/product/image', $img_args, $raw_settings ); | |
| 71 | - | |
| 72 | - /** | |
| 73 | - * Sale Badge. | |
| 74 | - */ | |
| 75 | - if ( ! empty( $p_sale ) ) { | |
| 76 | - ?> | |
| 77 | - <div class="rtsb-promotion"> | |
| 78 | - <?php | |
| 79 | - Fns::get_badge_html( $p_sale, $badge_class ); | |
| 80 | - ?> | |
| 81 | - </div> | |
| 82 | - <?php | |
| 83 | - } | |
| 84 | - | |
| 85 | - /** | |
| 86 | - * Action buttons above image. | |
| 87 | - */ | |
| 88 | - Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset, $action_btn_position, 'top' ) ); | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * After product image hook. | |
| 92 | - */ | |
| 93 | - do_action( 'rtsb/after/shop/product/image', $raw_settings ); | |
| 94 | - ?> | |
| 95 | - </div><!-- .rtsb-product-img --> | |
| 96 | - | |
| 97 | - <div class="rtsb-product-content"> | |
| 98 | - <?php | |
| 99 | - /** | |
| 100 | - * Before product content hook. | |
| 101 | - */ | |
| 102 | - do_action( 'rtsb/before/shop/product/content' ); | |
| 103 | - | |
| 104 | - /** | |
| 105 | - * Product Rating. | |
| 106 | - */ | |
| 107 | - if ( in_array( 'rating', $items, true ) ) { | |
| 108 | - Fns::get_product_rating_html( $rating_args ); | |
| 109 | - } | |
| 110 | - | |
| 111 | - /** | |
| 112 | - * Product Price. | |
| 113 | - */ | |
| 114 | - if ( in_array( 'price', $items, true ) ) { | |
| 115 | - ?> | |
| 116 | - <div class="product-price<?php echo esc_attr( $swatch_price_class ); ?>"> | |
| 117 | - <div class="price-wrapper"> | |
| 118 | - <?php | |
| 119 | - woocommerce_template_single_price(); | |
| 120 | - ?> | |
| 121 | - </div> | |
| 122 | - <?php | |
| 123 | - if ( in_array( 'swatches', $items, true ) && 'price' === $swatch_position ) { | |
| 124 | - Fns::get_product_swatches( $swatch_type ); | |
| 125 | - } | |
| 126 | - ?> | |
| 127 | - </div> | |
| 128 | - <?php | |
| 129 | - } | |
| 130 | - | |
| 131 | - /** | |
| 132 | - * Before product title hook. | |
| 133 | - */ | |
| 134 | - do_action( 'rtsb/before/shop/product/title' ); | |
| 135 | - | |
| 136 | - /** | |
| 137 | - * After product title hook. | |
| 138 | - */ | |
| 139 | - do_action( 'rtsb/after/shop/product/title' ); | |
| 140 | - | |
| 141 | - /** | |
| 142 | - * Action buttons after content. | |
| 143 | - */ | |
| 144 | - Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset, $action_btn_position, 'bottom' ) ); | |
| 145 | - | |
| 146 | - /** | |
| 147 | - * After product content hook. | |
| 148 | - */ | |
| 149 | - do_action( 'rtsb/after/shop/product/content', $raw_settings ); | |
| 150 | - | |
| 151 | - /** | |
| 152 | - * Product Title. | |
| 153 | - */ | |
| 154 | - if ( in_array( 'title', $items, true ) ) { | |
| 155 | - ?> | |
| 156 | - <div class="product-title-with-btn"> | |
| 157 | - <div class="rtsb-product-title-wrapper <?php echo esc_attr( $swatch_title_class ); ?>"> | |
| 158 | - <<?php Fns::print_validated_html_tag( $title_tag ); ?> class="<?php echo esc_attr( $title_class ); ?>"> | |
| 159 | - <?php | |
| 160 | - if ( $title_link ) { | |
| 161 | - ?> | |
| 162 | - <a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>"><?php Fns::print_html( $title ); ?></a> | |
| 163 | - <?php | |
| 164 | - } else { | |
| 165 | - Fns::print_html( $title ); | |
| 166 | - } | |
| 167 | - ?> | |
| 168 | - </<?php Fns::print_validated_html_tag( $title_tag ); ?>> | |
| 169 | - </div> | |
| 170 | - <div class="btn-wrap"> | |
| 171 | - <a class="woocommerce-LoopProduct-link rtsb-text-btn" href="<?php echo esc_url( $p_link ); ?>"> | |
| 172 | - <span class="text"><?php echo esc_html( $hover_btn_text ); ?></span> | |
| 173 | - | |
| 174 | - <?php | |
| 175 | - if ( ! empty( $hover_btn_icon ) ) { | |
| 176 | - Fns::print_html( $hover_btn_icon, true ); | |
| 177 | - } | |
| 178 | - ?> | |
| 179 | - </a> | |
| 180 | - </div> | |
| 181 | - </div> | |
| 182 | - <?php | |
| 183 | - } | |
| 184 | - ?> | |
| 185 | - </div><!-- .rtsb-product-content --> | |
| 186 | - </div><!-- .rtsb-grid-item --> | |
| 187 | - | |
| 188 | - <?php | |
| 189 | - /** | |
| 190 | - * After product item hook. | |
| 191 | - */ | |
| 192 | - do_action( 'rtsb/after/shop/product/item' ); | |
| 193 | - ?> | |
| 194 | -</div><!-- .rtsb-product --> | |
| 1 | +<?php | |
| 2 | +/** | |
| 3 | + * Template: Grid Layout 2. | |
| 4 | + * | |
| 5 | + * @package RadiusTheme\SB | |
| 6 | + */ | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Template variables: | |
| 10 | + * | |
| 11 | + * @var $grid string | |
| 12 | + * @var $class string | |
| 13 | + * @var $p_id int | |
| 14 | + * @var $image_link bool | |
| 15 | + * @var $p_link string | |
| 16 | + * @var $img_html string | |
| 17 | + * @var $hover_img_html string | |
| 18 | + * @var $hover_btn_text string | |
| 19 | + * @var $items array | |
| 20 | + * @var $add_to_cart string | |
| 21 | + * @var $title_tag string | |
| 22 | + * @var $excerpt_limit string | |
| 23 | + * @var $excerpt string | |
| 24 | + * @var $title_class string | |
| 25 | + * @var $title_link bool | |
| 26 | + * @var $title string | |
| 27 | + * @var $badge_class string | |
| 28 | + * @var $action_btn_preset string | |
| 29 | + * @var $action_btn_position string | |
| 30 | + * @var $raw_settings array | |
| 31 | + */ | |
| 32 | + | |
| 33 | +use RadiusTheme\SB\Helpers\Fns; | |
| 34 | + | |
| 35 | +// Do not allow directly accessing this file. | |
| 36 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 37 | + exit( 'This script cannot be accessed directly.' ); | |
| 38 | +} | |
| 39 | + | |
| 40 | +global $product; | |
| 41 | + | |
| 42 | +$classes = esc_attr( $grid ) . ' ' . esc_attr( $class ); | |
| 43 | +?> | |
| 44 | + | |
| 45 | +<div <?php wc_product_class( $classes, $product ); ?> data-id="<?php echo absint( $p_id ); ?>"> | |
| 46 | + <div class="rtsb-grid-item"> | |
| 47 | + <div class="rtsb-product-img"> | |
| 48 | + <?php | |
| 49 | + /** | |
| 50 | + * Product Image. | |
| 51 | + */ | |
| 52 | + if ( $image_link ) { | |
| 53 | + ?> | |
| 54 | + <figure> | |
| 55 | + <a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>" class="rtsb-img-link"> | |
| 56 | + <?php | |
| 57 | + Fns::get_product_image( $img_html, $hover_img_html ); | |
| 58 | + ?> | |
| 59 | + </a> | |
| 60 | + </figure> | |
| 61 | + <?php | |
| 62 | + } else { | |
| 63 | + echo '<figure class="rtsb-img-link">'; | |
| 64 | + Fns::get_product_image( $img_html, $hover_img_html ); | |
| 65 | + echo '</figure>'; | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Sale Badge. | |
| 70 | + */ | |
| 71 | + if ( ! empty( $p_sale ) ) { | |
| 72 | + ?> | |
| 73 | + <div class="rtsb-promotion"> | |
| 74 | + <?php | |
| 75 | + Fns::get_badge_html( $p_sale, $badge_class ); | |
| 76 | + ?> | |
| 77 | + </div> | |
| 78 | + <?php | |
| 79 | + } | |
| 80 | + | |
| 81 | + /** | |
| 82 | + * Action buttons. | |
| 83 | + */ | |
| 84 | + if ( 'above' === $action_btn_position ) { | |
| 85 | + Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset ) ); | |
| 86 | + } | |
| 87 | + ?> | |
| 88 | + </div><!-- .rtsb-product-img --> | |
| 89 | + | |
| 90 | + <div class="rtsb-product-content"> | |
| 91 | + <?php | |
| 92 | + /** | |
| 93 | + * Product Swatches. | |
| 94 | + */ | |
| 95 | + if ( in_array( 'swatches', $items, true ) ) { | |
| 96 | + ?> | |
| 97 | + <div class="rtsb-swatches square-layout"> | |
| 98 | + <?php | |
| 99 | + do_action( 'rtwpvs_show_archive_variation' ); | |
| 100 | + ?> | |
| 101 | + </div> | |
| 102 | + <?php | |
| 103 | + } | |
| 104 | + | |
| 105 | + /** | |
| 106 | + * Product Rating. | |
| 107 | + */ | |
| 108 | + if ( in_array( 'rating', $items, true ) ) { | |
| 109 | + Fns::get_product_rating_html(); | |
| 110 | + } | |
| 111 | + | |
| 112 | + /** | |
| 113 | + * Product Price. | |
| 114 | + */ | |
| 115 | + if ( in_array( 'price', $items, true ) ) { | |
| 116 | + ?> | |
| 117 | + <div class="product-price rtsb-item-space-between"> | |
| 118 | + <span class="price-wrapper"> | |
| 119 | + <?php | |
| 120 | + woocommerce_template_single_price(); | |
| 121 | + ?> | |
| 122 | + </span> | |
| 123 | + </div> | |
| 124 | + <?php | |
| 125 | + } | |
| 126 | + | |
| 127 | + /** | |
| 128 | + * Product Title. | |
| 129 | + */ | |
| 130 | + if ( in_array( 'title', $items, true ) ) { | |
| 131 | + ?> | |
| 132 | + <div class="product-title-with-btn"> | |
| 133 | + <<?php echo esc_attr( $title_tag ); ?> class="<?php echo esc_attr( $title_class ); ?>"> | |
| 134 | + <?php | |
| 135 | + if ( $title_link ) { | |
| 136 | + ?> | |
| 137 | + <a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>"><?php Fns::print_html( $title ); ?></a> | |
| 138 | + <?php | |
| 139 | + } else { | |
| 140 | + Fns::print_html( $title ); | |
| 141 | + } | |
| 142 | + ?> | |
| 143 | + </<?php echo esc_attr( $title_tag ); ?>> | |
| 144 | + | |
| 145 | + <div class="btn-wrap"> | |
| 146 | + <a class="woocommerce-LoopProduct-link" href="<?php echo esc_url( $p_link ); ?>" class="rtsb-text-btn"> | |
| 147 | + <span class="text"><?php echo esc_html( $hover_btn_text ); ?></span> | |
| 148 | + | |
| 149 | + <?php | |
| 150 | + if ( ! empty( $hover_btn_icon ) ) { | |
| 151 | + Fns::print_html( $hover_btn_icon, true ); | |
| 152 | + } | |
| 153 | + ?> | |
| 154 | + </a> | |
| 155 | + </div> | |
| 156 | + </div> | |
| 157 | + <?php | |
| 158 | + } | |
| 159 | + | |
| 160 | + /** | |
| 161 | + * Product Categories. | |
| 162 | + */ | |
| 163 | + if ( in_array( 'categories', $items, true ) ) { | |
| 164 | + ?> | |
| 165 | + <div class="rtsb-product-category"> | |
| 166 | + <?php | |
| 167 | + Fns::get_categories_list( $p_id ); | |
| 168 | + ?> | |
| 169 | + </div> | |
| 170 | + <?php | |
| 171 | + } | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * Product Short Description. | |
| 175 | + */ | |
| 176 | + if ( in_array( 'excerpt', $items, true ) ) { | |
| 177 | + ?> | |
| 178 | + <div class="product-short-description rtsb-text-limit limit-<?php echo esc_attr( $excerpt_limit ); ?>"> | |
| 179 | + <?php | |
| 180 | + Fns::print_html( $excerpt ); | |
| 181 | + ?> | |
| 182 | + </div> | |
| 183 | + <?php | |
| 184 | + } | |
| 185 | + | |
| 186 | + /** | |
| 187 | + * Action buttons. | |
| 188 | + */ | |
| 189 | + if ( 'after' === $action_btn_position ) { | |
| 190 | + Fns::print_html( Fns::get_formatted_action_buttons( $items, $add_to_cart, $action_btn_preset, $action_btn_position ) ); | |
| 191 | + } | |
| 192 | + ?> | |
| 193 | + </div><!-- .rtsb-product-content --> | |
| 194 | + </div><!-- .rtsb-grid-item --> | |
| 195 | +</div><!-- .rtsb-product --> | |