'', 'title' => '', 'sub_title' => '', 'at_all_page_items' => '', 'content_from' => 'excerpt', 'content_number' => -1, 'column_number' => 3, 'background_options' => 'default', 'single_item_link_option' => 'disable', 'display_type' => 'column', 'enable_prev_next' => 1, 'view_all_option' => 'disable', 'all_link_text' => '', 'all_link_url' => '' ); function __construct() { parent::__construct( /*Base ID of your widget*/ 'beauty_studio_imp_number', /*Widget name will appear in UI*/ esc_html__( 'AT Imp Number Section', 'beauty-studio' ), /*Widget description*/ array( 'description' => esc_html__( 'Show Section with Number.', 'beauty-studio' ) ) ); } /*Widget Backend*/ public function form( $instance ) { $instance = wp_parse_args( (array) $instance, $this->defaults ); /*default values*/ $unique_id = esc_attr( $instance['unique_id'] ); $title = esc_attr( $instance['title'] ); $sub_title = esc_textarea( $instance['sub_title'] ); $at_all_page_items = $instance['at_all_page_items']; $content_from = esc_attr( $instance['content_from'] ); $content_number = intval( $instance['content_number'] ); $column_number = absint( $instance['column_number'] ); $background_options = sanitize_key( $instance['background_options'] ); $single_item_link_option = esc_attr( $instance[ 'single_item_link_option' ] ); $display_type = esc_attr( $instance[ 'display_type' ] ); $enable_prev_next = esc_attr( $instance['enable_prev_next'] ); $view_all_option = esc_attr( $instance[ 'view_all_option' ] ); $all_link_text = esc_attr( $instance['all_link_text'] ); $all_link_url = esc_url( $instance['all_link_url'] ); ?>



0 ){ foreach ($at_all_page_items as $imp_number){ $select_page_id = $this->get_field_id( 'at_all_page_items') .$total_repeater.'page_id'; $select_page_name = $this->get_field_name( 'at_all_page_items' ).'['.$total_repeater.']['.'page_id'.']'; $imp_number_id = $this->get_field_id( 'at_all_page_items') .$total_repeater.'imp_number'; $imp_number_name = $this->get_field_name( 'at_all_page_items' ).'['.$total_repeater.']['.'imp_number'.']'; ?>

get_field_id( 'at_all_page_items') .$coder_repeater_depth.'page_id'; $select_page_name = $this->get_field_name( 'at_all_page_items' ).'['.$coder_repeater_depth.']['.'page_id'.']'; $imp_number_id = $this->get_field_id( 'at_all_page_items') .$coder_repeater_depth.'imp_number'; $imp_number_name = $this->get_field_name( 'at_all_page_items' ).'['.$coder_repeater_depth.']['.'imp_number'.']'; ?> '; $add_field = esc_html__('Add Item', 'beauty-studio'); echo ''.$add_field.'
'; ?>


/>



0 ){ foreach ( $at_all_page_items as $index=>$imp_numbers ){ foreach ( $imp_numbers as $key=>$value ){ $page_ids[$index][$key] = esc_attr( $value ); } } } } $instance['at_all_page_items'] = $page_ids; $beauty_studio_about_content_from = beauty_studio_content_from(); $instance['content_from'] = beauty_studio_sanitize_choice_options( $new_instance['content_from'], $beauty_studio_about_content_from, 'excerpt' ); $instance['content_number'] = intval( $new_instance['content_number'] ); $instance['column_number'] = absint( $new_instance['column_number'] ); $beauty_studio_adv_link_options = beauty_studio_adv_link_options(); $instance['single_item_link_option'] = beauty_studio_sanitize_choice_options( $new_instance['single_item_link_option'], $beauty_studio_adv_link_options, 'disable' ); $instance['view_all_option'] = beauty_studio_sanitize_choice_options( $new_instance['view_all_option'], $beauty_studio_adv_link_options, 'disable' ); $beauty_studio_widget_display_types = beauty_studio_widget_display_type(); $instance['display_type'] = beauty_studio_sanitize_choice_options( $new_instance['display_type'], $beauty_studio_widget_display_types, 'column' ); $instance[ 'all_link_text' ] = sanitize_text_field( $new_instance[ 'all_link_text' ] ); $instance[ 'all_link_url' ] = esc_url_raw( $new_instance[ 'all_link_url' ] ); $instance[ 'enable_prev_next' ] = isset($new_instance['enable_prev_next'])? 1 : 0; $instance['background_options'] = sanitize_key( $new_instance['background_options'] ); return $instance; } /** * Function to Creating widget front-end. This is where the action happens * * @access public * @since 1.0 * * @param array $args widget setting * @param array $instance saved values * * @return void * */ public function widget( $args, $instance ) { $instance = wp_parse_args( (array) $instance, $this->defaults ); /*default values*/ $unique_id = ! empty( $instance['unique_id'] ) ? esc_attr( $instance['unique_id'] ) : esc_attr( $this->id ); $title = apply_filters( 'widget_title', ! empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base ); $sub_title = apply_filters( 'widget_text', !empty( $instance['sub_title'] ) ? $instance['sub_title'] : '' , $instance ); $at_all_page_items = $instance['at_all_page_items']; $content_from = esc_attr( $instance['content_from'] ); $content_number = intval( $instance['content_number'] ); $column_number = absint( $instance['column_number'] ); $single_item_link_option = esc_attr( $instance[ 'single_item_link_option' ] ); $display_type = esc_attr( $instance[ 'display_type' ] ); $view_all_option = esc_attr( $instance[ 'view_all_option' ] ); $all_link_text = esc_html( $instance[ 'all_link_text' ] ); $all_link_url = esc_url( $instance[ 'all_link_url' ] ); $enable_prev_next = esc_attr( $instance['enable_prev_next'] ); $background_options = esc_attr( $instance['background_options'] ); $bg_gray_class = $background_options == 'gray'?'at-gray-bg':''; $animation = "init-animate zoomIn"; echo $args['before_widget']; ?>

"; echo ''; echo "";/*.at-action-wrapper*/ } $div_attr = 'class="row featured-entries-col featured-entries-logo '.$display_type.'"'; if( 'carousel' == $display_type ){ $div_attr = 'class="row featured-entries-col featured-entries-logo acme-slick-carausel" data-column="'.absint( $column_number ).'"'; } ?>
> 0 ){ foreach ( $at_all_page_items as $imp_number ){ if( isset( $imp_number['page_id'] ) && !empty( $imp_number['page_id'] ) ){ $post_in[] = $imp_number['page_id']; if( isset( $imp_number['imp_number'] ) && !empty( $imp_number['imp_number'] ) ){ $number[$imp_number['page_id']] = $imp_number['imp_number']; } } } } if( !empty( $post_in )) : $beauty_studio_child_page_args = array( 'post__in' => $post_in, 'orderby' => 'post__in', 'posts_per_page' => count( $post_in ), 'post_type' => 'page', 'no_found_rows' => true, 'post_status' => 'publish' ); $imp_number_query = new WP_Query( $beauty_studio_child_page_args ); $total_posts = $imp_number_query->post_count; /*The Loop*/ if ( $imp_number_query->have_posts() ): $beauty_studio_featured_index = 1; while ( $imp_number_query->have_posts() ):$imp_number_query->the_post(); $beauty_studio_list_classes = 'single-list '; if( 'carousel' != $display_type ){ if( 1 != $beauty_studio_featured_index && $beauty_studio_featured_index % $column_number == 1 ){ echo "
"; } if ( 1 == $column_number ) { $beauty_studio_list_classes .= "col-sm-12"; } elseif ( 2 == $column_number ) { $beauty_studio_list_classes .= "col-sm-6"; } elseif ( 3 == $column_number ) { $beauty_studio_list_classes .= "col-sm-4 col-md-4"; } else { $beauty_studio_list_classes .= "col-sm-3 col-md-3"; } } $imp_number = isset( $number[get_the_ID()] )?$number[get_the_ID()]:''; ?>
'; } $margin = ''; if( !empty( $imp_number ) ){ ?>

'; } the_title(); if( 'disable' != $single_item_link_option ){ echo ''; } ?>

'; } ?>