esc_html__('Testimonials','business-trade'), 'bg_image' => '', 'features' =>'', ); return $defaults; } public function __construct() { parent::__construct( /*Widget ID */ 'business_trade_testimonial_widget', /*Widget Name */ esc_html__( 'TM: Testimonial Widget', 'business-trade' ), /*Widget description */ array('description' => esc_html__( 'TM: Testimonial Widget, Best Used in Home page or other 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); $bg_image = esc_url($instance['bg_image']); $features = ( ! empty( $instance['features'] ) ) ? $instance['features'] : array(); echo $args['before_widget']; if (isset($features) && !empty($features['main'])) : ?>
defaults() ); $title = esc_attr( $instance['title'] ); $bgimage = esc_url( $instance['bg_image'] ); $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 ct-select', 'show_oction_none' => __( 'Select Page', 'business-trade'), 'oction_none_value' => 0 // string ); wp_dropdown_pages( $args ); $counter = 0; if ( count( $features ) > 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 ct-select', 'show_oction_none' => __( 'Select Page', 'business-trade'), 'oction_none_value' => 0 // string ); wp_dropdown_pages( $args ); ?>

style="display:none;" > <?php esc_attr_e( 'Image preview', 'business-trade' ); ?>