'', 'title' => '', 'at_all_page_items' => '', 'read_more_text' => esc_html__( 'Read More', 'event-star' ), 'background_options' => 'gray' ); return $defaults; } function __construct() { parent::__construct( /*Base ID of your widget*/ 'event_star_schedule', /*Widget name will appear in UI*/ esc_html__('AT Schedule Section', 'event-star'), /*Widget description*/ array( 'description' => esc_html__( 'Show Schedule Section.', 'event-star' ) ) ); } /*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' ] ); $at_all_page_items = $instance['at_all_page_items']; $read_more_text = esc_attr( $instance[ 'read_more_text' ] ); $background_options = esc_attr( $instance['background_options'] ); ?>



0 && is_array($at_all_page_items) ){ foreach ($at_all_page_items as $tab_title){ $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'.']'; $tab_title_id = $this->get_field_id( 'at_all_page_items') .$total_repeater.'tab_title'; $tab_title_name = $this->get_field_name( 'at_all_page_items' ).'['.$total_repeater.']['.'tab_title'.']'; ?>

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'.']'; $tab_title_id = $this->get_field_id( 'at_all_page_items') .$coder_repeater_depth.'tab_title'; $tab_title_name = $this->get_field_name( 'at_all_page_items' ).'['.$coder_repeater_depth.']['.'tab_title'.']'; ?> '; $add_field = esc_html__('Add Item', 'event-star'); echo ''.$add_field.'
'; ?>

0 && is_array($at_all_page_items) ){ foreach ( $at_all_page_items as $index=>$tab_titles ){ foreach ( $tab_titles as $key=>$value ){ if( 'page_id' ==$key ){ $page_ids[$index][$key] = event_star_sanitize_page( $value ); } else{ $page_ids[$index][$key] = sanitize_text_field( $value ); } } } } } $instance['at_all_page_items'] = $page_ids; $instance[ 'read_more_text' ] = sanitize_text_field( $new_instance[ 'read_more_text' ] ); $event_star_widget_background_options = event_star_background_options(); $instance[ 'background_options' ] = event_star_sanitize_choice_options( $new_instance[ 'background_options' ], $event_star_widget_background_options, 'default' ); return $instance; } /** * Function to Creating widget front-end. This is where the action happens * * @access public * @since 1.0.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 ); $at_all_page_items = $instance['at_all_page_items']; $read_more_text = esc_html( $instance[ 'read_more_text' ] ); $background_options = esc_attr( $instance['background_options'] ); $bg_gray_class = $background_options == 'gray'?'at-gray-bg':''; echo $args['before_widget']; ?>
0 && is_array($at_all_page_items) ){ foreach ( $at_all_page_items as $about ){ if( isset( $about['page_id'] ) && !empty( $about['page_id'] ) ){ $post_in[] = $about['page_id']; if( isset( $about['tab_title'] ) && !empty( $about['tab_title'] ) ){ $tab_title[$about['page_id']] = $about['tab_title']; } } } } if( !empty( $post_in ) ): $event_star_post_in_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' ); $schedule_query = new WP_Query( $event_star_post_in_page_args ); $animation1 = "init-animate zoomIn"; /*The Loop*/ if ( $schedule_query->have_posts() ): echo "
"; $i=0; while( $schedule_query->have_posts() ):$schedule_query->the_post(); $active = ( $i == 0?'active':'' ); $tab_final_title = isset( $tab_title[get_the_ID()] )?$tab_title[get_the_ID()]:''; ?> "; echo "
"; $i=0; while( $schedule_query->have_posts() ):$schedule_query->the_post(); $active = ( $i == 0 ? 'active' : '') ?> "; else: /*do nothing for now*/ endif; endif; wp_reset_postdata(); ?>