$title, 'url' => $url, ); return ' data-slide=\'' . wp_json_encode( $data ) . '\''; } } if ( ! function_exists( 'woodmart_shortcode_slider' ) ) { /** * Slider shortcode. * * @param array $atts Element settings. * * @return false|string|void */ function woodmart_shortcode_slider( $atts ) { $class = ''; $parsed_atts = shortcode_atts( array( 'slider' => '', 'el_class' => '', 'elementor' => false, ), $atts ); $class .= ' ' . $parsed_atts['el_class']; $class .= woodmart_get_old_classes( ' woodmart-slider' ); $slider_term = get_term_by( 'slug', $parsed_atts['slider'], 'woodmart_slider' ); if ( is_wp_error( $slider_term ) || empty( $slider_term ) ) { return; } $args = array( 'posts_per_page' => -1, 'post_type' => 'woodmart_slide', 'orderby' => 'menu_order', 'order' => 'ASC', 'tax_query' => array( // phpcs:ignore array( 'taxonomy' => 'woodmart_slider', 'field' => 'id', 'terms' => $slider_term->term_id, ), ), ); $slides = get_posts( $args ); if ( is_wp_error( $slides ) || empty( $slides ) ) { return; } $stretch_slider = get_term_meta( $slider_term->term_id, 'stretch_slider', true ); $carousel_id = 'slider-' . $slider_term->term_id; $animation = get_term_meta( $slider_term->term_id, 'animation', true ); $arrows_style = get_term_meta( $slider_term->term_id, 'arrows_style', true ); $pagination_style = get_term_meta( $slider_term->term_id, 'pagination_style', true ); if ( '' === $pagination_style ) { $pagination_style = 1; } if ( '' === $arrows_style ) { $arrows_style = 1; } $slide_speed = apply_filters( 'woodmart_slider_sliding_speed', 900 ); $slider_atts = array( 'carousel_id' => $carousel_id, 'hide_pagination_control' => get_term_meta( $slider_term->term_id, 'pagination_style', true ) === '0' ? 'yes' : 'no', 'hide_prev_next_buttons' => get_term_meta( $slider_term->term_id, 'arrows_style', true ) === '0' ? 'yes' : 'no', 'autoplay' => ( get_term_meta( $slider_term->term_id, 'autoplay', true ) === 'on' ) ? 'yes' : 'no', 'speed' => get_term_meta( $slider_term->term_id, 'autoplay_speed', true ) ? get_term_meta( $slider_term->term_id, 'autoplay_speed', true ) : 9000, 'sliding_speed' => $slide_speed, 'content_animation' => true, 'autoheight' => 'yes', 'wrap' => 'yes', 'library' => 'flickity', ); if ( is_user_logged_in() ) { $slider_atts['slider'] = array( 'title' => $slider_term->name, 'url' => get_edit_term_link( $slider_term->term_id, 'woodmart_slider' ), ); } if ( ! $parsed_atts['elementor'] ) { ob_start(); } woodmart_enqueue_js_library( 'flickity' ); woodmart_enqueue_js_script( 'slider-element' ); woodmart_enqueue_inline_style( 'slider' ); if ( 'fade' === $animation ) { woodmart_enqueue_js_library( 'flickity-fade' ); } elseif ( 'distortion' === $animation ) { woodmart_enqueue_inline_style( 'slider-anim-distortion' ); } if ( $arrows_style ) { woodmart_enqueue_inline_style( 'slider-arrows' ); } if ( $pagination_style ) { woodmart_enqueue_inline_style( 'slider-dots' ); woodmart_enqueue_inline_style( 'slider-dots-style-' . $pagination_style ); } $first_slide_key = array_key_first( $slides ); ?> term_id, $carousel_id, $slides ); ?> ID ); // phpcs:ignore ?>
'; ?> # .wd-slide { min-height: px; } @media (min-width: 1025px) { .browser-Internet # .wd-slide { height: px; } } @media (max-width: 1024px) { # .wd-slide { min-height: px; } } @media (max-width: 767px) { # .wd-slide { min-height: px; } } ID, 'bg_color', true ); $content_full_width = get_post_meta( $slide->ID, 'content_full_width', true ); // Desktop. $bg_image_desktop = has_post_thumbnail( $slide->ID ) ? wp_get_attachment_url( get_post_thumbnail_id( $slide->ID ) ) : ''; $meta_bg_image_desktop = get_post_meta( $slide->ID, 'bg_image_desktop', true ); if ( is_array( $meta_bg_image_desktop ) && isset( $meta_bg_image_desktop['url'] ) ) { $meta_bg_image_desktop = $meta_bg_image_desktop['url']; } if ( $meta_bg_image_desktop ) { $bg_image_desktop = $meta_bg_image_desktop; } $bg_image_size_desktop = get_post_meta( $slide->ID, 'bg_image_size_desktop', true ); $bg_image_position_desktop = get_post_meta( $slide->ID, 'bg_image_position_desktop', true ); $bg_image_position_x_desktop = get_post_meta( $slide->ID, 'bg_image_position_x_desktop', true ); $bg_image_position_y_desktop = get_post_meta( $slide->ID, 'bg_image_position_y_desktop', true ); $width_desktop = get_post_meta( $slide->ID, 'content_width', true ); // Tablet. $width_tablet = get_post_meta( $slide->ID, 'content_width_tablet', true ); $bg_image_tablet = get_post_meta( $slide->ID, 'bg_image_tablet', true ); if ( is_array( $bg_image_tablet ) && isset( $bg_image_tablet['url'] ) ) { $bg_image_tablet = $bg_image_tablet['url']; } $bg_image_size_tablet = get_post_meta( $slide->ID, 'bg_image_size_tablet', true ); $bg_image_position_tablet = get_post_meta( $slide->ID, 'bg_image_position_tablet', true ); $bg_image_position_x_tablet = get_post_meta( $slide->ID, 'bg_image_position_x_tablet', true ); $bg_image_position_y_tablet = get_post_meta( $slide->ID, 'bg_image_position_y_tablet', true ); // Mobile. $width_mobile = get_post_meta( $slide->ID, 'content_width_mobile', true ); $bg_image_mobile = get_post_meta( $slide->ID, 'bg_image_mobile', true ); if ( is_array( $bg_image_mobile ) && isset( $bg_image_mobile['url'] ) ) { $bg_image_mobile = $bg_image_mobile['url']; } $bg_image_size_mobile = get_post_meta( $slide->ID, 'bg_image_size_mobile', true ); $bg_image_position_mobile = get_post_meta( $slide->ID, 'bg_image_position_mobile', true ); $bg_image_position_x_mobile = get_post_meta( $slide->ID, 'bg_image_position_x_mobile', true ); $bg_image_position_y_mobile = get_post_meta( $slide->ID, 'bg_image_position_y_mobile', true ); ?> #slide-ID ); ?>.woodmart-loaded .wd-slide-bg { } #slide-ID ); ?> .wd-slide-bg { } #slide-ID ); ?> .wd-slide-inner { } @media (max-width: 1024px) { #slide-ID ); ?>.woodmart-loaded .wd-slide-bg { } #slide-ID ); ?> .wd-slide-inner { } #slide-ID ); ?> .wd-slide-bg { } } @media (max-width: 767px) { #slide-ID ); ?>.woodmart-loaded .wd-slide-bg { } #slide-ID ); ?> .wd-slide-inner { } #slide-ID ); ?> .wd-slide-bg { } } ID, '_wpb_shortcodes_custom_css', true ) ) : ?> ID, '_wpb_shortcodes_custom_css', true ); // phpcs:ignore ?> ID, 'woodmart_shortcodes_custom_css', true ) ) : ?> ID, 'woodmart_shortcodes_custom_css', true ); // phpcs:ignore ?> '; } } if ( ! function_exists( 'woodmart_maybe_set_css_rule' ) ) { /** * Get CSS rule. * * @param string $rule CSS rule. * @param string $value Value. * @param string $before Before value. * @param string $after After value. */ function woodmart_maybe_set_css_rule( $rule, $value = '', $before = '', $after = '' ) { if ( in_array( $rule, array( 'width', 'height', 'max-width', 'max-height' ), true ) && empty( $after ) ) { $after = 'px'; } if ( in_array( $rule, array( 'background-image' ), true ) && ( empty( $before ) || empty( $after ) ) ) { $before = 'url('; $after = ')'; } echo ! empty( $value ) ? $rule . ':' . $before . $value . $after . ';' : ''; // phpcs:ignore } } if ( ! function_exists( 'woodmart_get_slider_class' ) ) { /** * Get slider classes. * * @param int $id Slider ID. * * @return string */ function woodmart_get_slider_class( $id ) { $class = ''; $arrows_style = get_term_meta( $id, 'arrows_style', true ); $pagination_style = get_term_meta( $id, 'pagination_style', true ); $pagination_hr_align = get_term_meta( $id, 'pagination_horizon_align', true ); $pagination_color = get_term_meta( $id, 'pagination_color', true ); $stretch_slider = get_term_meta( $id, 'stretch_slider', true ); $stretch_content = get_term_meta( $id, 'stretch_content', true ); $scroll_carousel_init = get_term_meta( $id, 'scroll_carousel_init', true ); $animation = get_term_meta( $id, 'animation', true ); if ( ! $pagination_hr_align ) { $pagination_hr_align = 'center'; } if ( '' === $pagination_style ) { $pagination_style = 1; } if ( '' === $arrows_style ) { $arrows_style = 1; } $class .= ' arrows-style-' . $arrows_style; $class .= ' pagin-style-' . $pagination_style; $class .= ' pagin-scheme-' . $pagination_color; $class .= ' anim-' . $animation; $class .= ' wd-pagin-hr-' . $pagination_hr_align; $class .= woodmart_get_old_classes( ' woodmart-slider-wrapper' ); if ( 'on' === $scroll_carousel_init ) { woodmart_enqueue_js_library( 'waypoints' ); $class .= ' scroll-init'; } if ( 'on' === $stretch_slider ) { if ( 'wpb' === woodmart_get_current_page_builder() ) { $class .= ' vc_row vc_row-fluid'; } else { $class .= ' wd-section-stretch'; } if ( 'on' === $stretch_content ) { $class .= ' wd-full-width-content'; } } else { $class .= ' slider-in-container'; } return $class; } } if ( ! function_exists( 'woodmart_get_slide_class' ) ) { /** * Get slide classes. * * @param int $id Post ID. * * @return string */ function woodmart_get_slide_class( $id ) { $class = ''; $v_align = get_post_meta( $id, 'vertical_align', true ); $h_align = get_post_meta( $id, 'horizontal_align', true ); $v_align_tablet = get_post_meta( $id, 'vertical_align_tablet', true ); $h_align_tablet = get_post_meta( $id, 'horizontal_align_tablet', true ); $v_align_mobile = get_post_meta( $id, 'vertical_align_mobile', true ); $h_align_mobile = get_post_meta( $id, 'horizontal_align_mobile', true ); $full_width = get_post_meta( $id, 'content_full_width', true ); $without_padding = get_post_meta( $id, 'content_without_padding', true ); $class .= ' wd-items-' . $v_align; $class .= ' wd-justify-' . $h_align; if ( $v_align_tablet ) { $class .= ' wd-items-md-' . $v_align_tablet; } if ( $h_align_tablet ) { $class .= ' wd-justify-md-' . $h_align_tablet; } if ( $v_align_mobile ) { $class .= ' wd-items-sm-' . $v_align_mobile; } if ( $h_align_mobile ) { $class .= ' wd-justify-sm-' . $h_align_mobile; } $class .= ' content-' . ( $full_width ? 'full-width' : 'fixed' ); $class .= $without_padding ? ' slide-without-padding' : ''; return apply_filters( 'woodmart_slide_classes', $class ); } }