esc_html__('Feature Services','business-trade'), 'no_of_words' => 30, 'features' => '' ); return $defaults; } public function __construct() { parent::__construct( /*Base ID of your widget*/ 'business_trade_service_widget', /*Widget name will appear in UI*/ esc_html__( 'TM: Feature Service Widget', 'business-trade' ), /*Widget description*/ array( 'description' => esc_html__( 'TM: Feature Service Widget, Best Used in Home page', 'business-trade' ) ) ); } /** * 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 ) { if (!empty( $instance ) ) { $instance = wp_parse_args( (array ) $instance, $this->defaults ()); $title = apply_filters('widget_title', !empty($instance['title']) ? esc_html( $instance['title']): '', $instance, $this->id_base); $no_of_words = absint($instance['no_of_words']); $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array(); if (isset($features) ) : echo $args['before_widget']; ?>

0 && is_array($features) ) { $post_in[0] = $features['main']; foreach ( $features as $our_services ) { if( isset( $our_services['page_ids'] ) && !empty( $our_services['page_ids'] ) ) { $post_in[] = $our_services['page_ids']; } } } if( !empty( $post_in )) : $services_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' ); $services_query = new WP_Query( $services_page_args ); /*The Loop*/ if ( $services_query->have_posts() ): $i = 1; while ( $services_query->have_posts() ):$services_query->the_post(); ?>
<?php echo esc_attr($alt); ?>

defaults() ); $title = esc_attr( $instance['title'] ); $no_of_words = absint($instance['no_of_words']); $features = ( !empty( $instance['features'] ) ) ? $instance['features'] : array(); ?>






= 1 && is_array( $features ) ) { $selected = $features['main']; } else { $selected = ""; } $repeater_id = $this->get_field_id( 'features' ).'-main'; $repeater_name = $this->get_field_name( 'features'). '[main]'; $args = array( 'selected' => $selected, 'name' => $repeater_name, 'id' => $repeater_id, 'class' => 'widefat tm-select', 'show_option_none' => __( 'Select Page', 'business-trade'), 'option_none_value' => 0 // string ); wp_dropdown_pages( $args ); ?> 0 ) { foreach( $features as $feature ) { if ( isset( $feature['page_ids'] ) ) { ?>
get_field_id( 'features' ) .'-'. $counter.'-page_ids'; $repeater_name = $this->get_field_name( 'features' ) . '['.$counter.'][page_ids]'; $args = array( 'selected' => $feature['page_ids'], 'name' => $repeater_name, 'id' => $repeater_id, 'class' => 'widefat tm-select', 'show_option_none' => __( 'Select Page', 'business-trade'), 'option_none_value' => 0 // string ); wp_dropdown_pages( $args ); ?>