'',
'bg_image' => '',
);
return $defaults;
}
public function __construct()
{
parent::__construct(
'nexas-testimonial-widget',
esc_html__( 'Nexas Testimonial Widget', 'nexas' ),
array('description' => esc_html__( 'Nexas Testimonial Section', 'nexas' ) )
);
}
public function widget($args, $instance)
{
if (!empty($instance)) {
$instance = wp_parse_args((array )$instance, $this->defaults());
$testimonials_page_items = $instance['testimonials_page_items'];
$bg_image = esc_url($instance['bg_image']);
echo $args['before_widget'];
?>
0 && is_array($testimonials_page_items) ){
foreach ( $testimonials_page_items as $features ){
if( isset( $features['page_id'] ) && !empty( $features['page_id'] ) ){
$post_in[] = $features['page_id'];
}
}
}
if( !empty( $post_in )) :
$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'
);
$testimonials_query = new WP_Query( $testimonials_page_args );
/*The Loop*/
if ( $testimonials_query->have_posts() ):
while ( $testimonials_query->have_posts() ):$testimonials_query->the_post(); ?>
1) {
?>
0 && is_array($testimonials_page_items) ){
foreach ($testimonials_page_items as $key=>$about ){
$page_ids[$key]['page_id'] = absint( $about['page_id'] );
}
}
}
$instance['testimonials_page_items'] = $page_ids;
return $instance;
}
public function form( $instance )
{
$instance = wp_parse_args( (array )$instance, $this->defaults() );
$testimonials_page_items = $instance['testimonials_page_items'];
$bgimage = esc_url( $instance['bg_image'] );
?>
0 && is_array($testimonials_page_items) ){
foreach ($testimonials_page_items as $about){
$repeater_id = $this->get_field_id( 'testimonials_page_items') .$total_repeater.'page_id';
$repeater_name = $this->get_field_name( 'testimonials_page_items' ).'['.$total_repeater.']['.'page_id'.']';
?>
$about['page_id'],
'name' => $repeater_name,
'id' => $repeater_id,
'class' => 'widefat pt-select',
'show_option_none' => __( 'Select Page', 'nexas'),
'option_none_value' => 0 // string
);
wp_dropdown_pages( $args );
?>
get_field_id( 'testimonials_page_items') .$coder_repeater_depth.'page_id';
$repeater_name = $this->get_field_name( 'testimonials_page_items' ).'['.$coder_repeater_depth.']['.'page_id'.']';
?>
';
$add_field = __('Add Item', 'nexas');
echo '
'.$add_field.'';
?>
';
endif;
?>