'',
'title' => esc_html__( 'WHAT OUR CLIENT SAYS', 'business-uncode' ),
'image' => '',
'sub-title' => '',
);
return $defaults;
}
public function __construct() {
parent::__construct(
'Construction-testimonials-widget',
esc_html__( 'BU: Testimonials Widget', 'business-uncode' ),
array( 'description' => esc_html__( 'Construction Testimonials Section', 'business-uncode' ) )
);
}
public function form( $instance ) {
$instance = wp_parse_args( (array ) $instance, $this->defaults() );
$themesdivine_page_items = $instance['themesdivine_page_items'];
$title = esc_attr( $instance['title'] );
$image = esc_url( $instance['image'] );
$subtitle = esc_html( $instance['sub-title'] );
$page_id = absint( $instance[ 'page_id' ] );
?>
get_field_id( 'themesdivine_page_items') .$total_repeater.'page_id';
$repeater_name = $this->get_field_name( 'themesdivine_page_items' ).'['.$total_repeater.']['.'page_id'.']';
?>
$page_id,
'name' => $repeater_name,
'id' => $repeater_id,
'class' => 'widefat themesdivine-select',
'show_option_none' => __( 'Select Page', 'business-uncode'),
'option_none_value' => 0 // string
);
wp_dropdown_pages( $args );
?>
get_field_id( 'themesdivine_page_items') .$structure_repeater_depth.'page_id';
$repeater_name = $this->get_field_name( 'themesdivine_page_items' ).'['.$structure_repeater_depth.']['.'page_id'.']';
?>
';
$add_field = __('Add Item', 'business-uncode');
echo '
'.$add_field.'';
?>
';
endif;
?>
0 && is_array($themesdivine_page_items) ){
foreach ($themesdivine_page_items as $key=>$about ){
$page_ids[$key]['page_id'] = absint( $about['page_id'] );
}
}
}
$instance['themesdivine_page_items'] = $page_ids; $instance['title'] = sanitize_text_field( $new_instance['title'] );
$instance['sub-title'] = sanitize_text_field( $new_instance['sub-title'] );
$instance['image'] = esc_url_raw( $new_instance['image'] );
return $instance;
}
public function widget( $args, $instance ) {
if ( ! empty( $instance ) ) {
$instance = wp_parse_args( (array ) $instance, $this->defaults() );
echo $args['before_widget'];
$themesdivine_page_items = $instance['themesdivine_page_items'];
$title = apply_filters( 'widget_title', ! empty( $instance['title'] ) ? esc_html( $instance['title'] ) : '', $instance, $this->id_base );
$image = esc_url( $instance['image'] );
$subtitle = esc_html( $instance['sub-title'] );
?>
< 0 && is_array($themesdivine_page_items) ){
foreach ( $themesdivine_page_items as $our_testimonials ){
if( isset( $our_testimonials['page_id'] ) && !empty( $our_testimonials['page_id'] ) ){
$post_in[] = $our_testimonials['page_id'];
}
}
}
if( !empty( $post_in )) :
$our_testimonials_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'
);
$our_testimonials_query = new WP_Query( $our_testimonials_page_args );
/*The Loop*/
if ( $our_testimonials_query->have_posts() ):
$i = 1;
while ( $our_testimonials_query->have_posts() ):$our_testimonials_query->the_post();
?>