0,
'character_limit' => 25,
'sub_title' => esc_html__('About Nexas', 'nexas'),
'read_more' => esc_html__('Read More', 'nexas')
);
return $defaults;
}
public function __construct()
{
parent::__construct(
'nexas-welcome-msg-widget',
esc_html__( 'Nexas Welcome Message', 'nexas' ),
array( 'description' => esc_html__( 'Nexas Welcome Message', 'nexas' ) )
);
}
public function widget( $args, $instance )
{
if ( !empty( $instance ) ) {
$instance = wp_parse_args( (array )$instance, $this->defaults() );
$page_id = absint($instance['page_id']);
$limit_character = absint( $instance['character_limit'] );
$sub_title = esc_html( $instance['sub_title'] );
$read_more = esc_html( $instance['read_more'] );
echo $args['before_widget'];
if ( !empty( $page_id ) ) {
$nexas_page_args = array(
'page_id' => $page_id,
'posts_per_page' => 1,
'post_type' => 'page',
'no_found_rows' => true,
'post_status' => 'publish'
);
$welcome_query = new WP_Query( $nexas_page_args );
if ($welcome_query->have_posts()):
while ($welcome_query->have_posts()):$welcome_query->the_post(); ?>
$page_id,
'name' => esc_attr( $this->get_field_name('page_id') ),
'id' => esc_attr( $this->get_field_id('page_id') ),
'class' => 'widefat',
'show_option_none' => esc_html__( 'Select Page', 'nexas' ),
);
wp_dropdown_pages($args);
?>