'',
'button-text' => esc_html__('Learn More','nexas'),
'button-text-link' => '#',
'background-image' => '',
);
return $defaults;
}
public function __construct()
{
parent::__construct(
'nexas-our-mission-widget',
esc_html__('Nexas Our Misson Page', 'nexas'),
array('description' => esc_html__(' Nexas Our Mission Page', 'nexas'))
);
}
public function widget($args, $instance)
{
if ( !empty($instance ) ) {
$instance = wp_parse_args((array)$instance, $this->defaults());
$page_id = absint($instance['page_id']);
$button_text = esc_html($instance['button-text']);
$button_url = esc_url($instance['button-text-link']);
$bgimage = esc_url($instance['background-image']);
echo $args['before_widget'];
$nexas_page_args = array(
'page_id' => $page_id,
'posts_per_page' => 1,
'post_type' => 'page',
'no_found_rows' => true,
'post_status' => 'publish'
);
$mission_query = new WP_Query($nexas_page_args);
if ($mission_query->have_posts()):
while ($mission_query->have_posts()):$mission_query->the_post();
if (has_post_thumbnail()) {
$image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id, 'full', true);
$image_path = $image_url[0];
}
if (empty($image_path)) {
$value = 12;
}
else
{
$value = 12;
}
?>
$page_id,
'name' => $this->get_field_name( 'page_id' ),
'id' => $this->get_field_id( 'page_id' ),
'class' => 'widefat',
'show_option_none' => esc_attr__( 'Select Page', 'nexas' )
);
wp_dropdown_pages($args);
?>
style="display:none;" >