'',
'bg_image' => '',
'title' => '',
'at_all_page_items' => ''
);
function __construct() {
parent::__construct(
/*Base ID of your widget*/
'event_star_testimonial',
/*Widget name will appear in UI*/
esc_html__('AT Testimonial Section', 'event-star'),
/*Widget description*/
array(
'description' => esc_html__( 'Show Testimonial 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' ] );
$bg_image = esc_url( $instance[ 'bg_image' ] );
$title = esc_attr( $instance[ 'title' ] );
$at_all_page_items = $instance['at_all_page_items'];
?>
>
0 && is_array($at_all_page_items) ){
foreach ($at_all_page_items as $about){
$repeater_id = $this->get_field_id( 'at_all_page_items') .$total_repeater.'page_id';
$repeater_name = $this->get_field_name( 'at_all_page_items' ).'['.$total_repeater.']['.'page_id'.']';
?>
$about['page_id'],
'name' => $repeater_name,
'id' => $repeater_id,
'class' => 'widefat at-select',
'show_option_none' => esc_html__( 'Select Page', 'event-star'),
'option_none_value' => 0 // string
);
wp_dropdown_pages( $args );
?>
get_field_id( 'at_all_page_items') .$coder_repeater_depth.'page_id';
$repeater_name = $this->get_field_name( 'at_all_page_items' ).'['.$coder_repeater_depth.']['.'page_id'.']';
?>
';
$add_field = esc_html__('Add Item', 'event-star');
echo '
'.$add_field.'';
?>
0 && is_array($at_all_page_items) ){
foreach ($at_all_page_items as $key=>$about ){
$page_ids[$key]['page_id'] = event_star_sanitize_page( $about['page_id'] );
}
}
}
$instance['at_all_page_items'] = $page_ids;
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 );
$bg_image = esc_url( $instance['bg_image'] );
$title = apply_filters( 'widget_title', !empty( $instance['title'] ) ? $instance['title'] : '', $instance, $this->id_base );
$at_all_page_items = $instance['at_all_page_items'];
echo $args['before_widget'];
$bg_image_style = '';
if ( !empty( $bg_image ) ) {
$bg_image_style .= 'background-image:url(' . $bg_image . ');background-repeat:no-repeat;background-size:cover;background-attachment:fixed;background-position: center;';
$bg_image_class = 'at-parallax';
}
else{
$bg_image_class = 'at-no-parallax';
}
?>