rest_base ) ? $taxonomy_object->rest_base : $taxonomy; $term_ids = isset( $post[ $rest_base ] ) && is_array( $post[ $rest_base ] ) ? $post[ $rest_base ] : []; foreach ( $term_ids as $term_id ) { $term = get_term( absint( $term_id ), $taxonomy ); if ( $term && ! is_wp_error( $term ) ) { $terms[] = $term; } } } return $terms; } } if ( ! function_exists( 'gutslider_post_slider' ) ) { function gutslider_post_slider( $attributes ) { // Extract attributes with default values $defaults = [ 'queryPosts' => [], 'showTitle' => true, 'showCat' => true, 'showExcerpt' => true, 'showBtn' => true, 'linkTitle' => true, 'titleTag' => 'h2', 'btnLabel' => __( 'Read More', 'slider-blocks' ), 'enableOverlay' => true, 'sliderType' => 'slider', 'uniqueId' => '', 'navContainerPosition' => 'nav_inside', 'navPosition' => 'nav_cc', 'catAnimation' => '', 'titleAnimation' => '', 'exptAnimation' => '', 'btnAnimation' => '', 'sliderOptions' => [], 'showNavigation' => true, 'showPagination' => true, 'customNavIcon' => false, 'navIconSource' => 'library', 'navPrevIcon' => 'arrowLeft', 'navNextIcon' => 'arrowRight', 'customPrevSVG' => '', 'customNextSVG' => '', 'excerptLength' => 20, 'enableRemoteNav' => false, 'remotePrevSelector' => '', 'remoteNextSelector' => '', 'detachContent' => false, // New attribute for detaching content 'showThumbs' => false, 'thumbContent' => 'image', 'thumbTitlePosition' => 'below', 'thumbsOptions' => [], ]; $atts = wp_parse_args( $attributes, $defaults ); // Sanitize attributes $atts = array_map( 'sanitize_text_field', $atts ); $atts['queryPosts'] = isset( $attributes['queryPosts'] ) ? $attributes['queryPosts'] : []; $atts['sliderOptions'] = isset( $attributes['sliderOptions'] ) ? $attributes['sliderOptions'] : []; $atts['thumbsOptions'] = isset( $attributes['thumbsOptions'] ) ? $attributes['thumbsOptions'] : []; $atts['focusPoints'] = isset( $attributes['focusPoints'] ) ? $attributes['focusPoints'] : []; // Taxonomies the slider is filtered by. `taxQuery` covers every taxonomy; // `specificCategories` is the legacy, core-category-only attribute kept for blocks // saved before that. The editor empties it as soon as a filter is changed, so only // one of the two is ever in play. $tax_query = isset( $attributes['taxQuery'] ) && is_array( $attributes['taxQuery'] ) ? $attributes['taxQuery'] : []; $query_type = isset( $attributes['queryType'] ) ? sanitize_key( $attributes['queryType'] ) : 'latest_posts'; $term_taxonomies = [ 'category' ]; if ( 'specific_categories' === $query_type && ! empty( $tax_query ) ) { $term_taxonomies = array_map( 'sanitize_key', array_keys( $tax_query ) ); } // Block classes $block_classes = [ esc_attr( $atts['uniqueId'] ), esc_attr( $atts['navContainerPosition'] ), esc_attr( $atts['navPosition'] ), ]; // Block wrapper attributes $block_props = get_block_wrapper_attributes( [ 'class' => implode( ' ', array_filter( $block_classes ) ) ] ); // Single block classes $swiper_classes = [ 'swiper-slide', $atts['sliderType'] === 'slider' ? 'slide-mode' : '' ]; if ( ! empty( $atts['detachContent'] ) ) { $swiper_classes[] = 'detach-content'; } ?>
data-swiper-options="" >
style="" >
<?php echo esc_attr( $post_title ); ?>
%s', esc_html( $post_term->name ) ); } ?>
%3$s', $title_tag, esc_attr( $atts['titleAnimation'] ), esc_html( $post_title ) ); if ( $atts['linkTitle'] ) { printf( '%s', esc_url( $post_link ), $title_content // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ); } else { echo wp_kses_post( $title_content ); } ?>
0 ) { $post_excerpt = wp_trim_words( $post_excerpt, $atts['excerptLength'], '...' ); } echo wp_kses_post( $post_excerpt ); ?>
<?php echo esc_attr( $thumb_alt ); ?>