id_base,
__( 'Astra: Address', 'astra-widgets' ),
array(
'classname' => $this->id_base,
'description' => __( 'Display Address.', 'astra-widgets' ),
),
array(
'id_base' => $this->id_base,
)
);
}
/**
* Widget
*
* @param array $args Widget arguments.
* @param array $instance Widget instance.
* @return void
*/
function widget( $args, $instance ) {
wp_enqueue_style( 'astra-widgets-font-style' );
$title = apply_filters( 'widget_title', $instance['title'] );
$style = isset( $instance['style'] ) ? $instance['style'] : 'stack';
$social_icons = isset( $instance['display-icons'] ) ? $instance['display-icons'] : false;
$address = isset( $instance['address'] ) ? $instance['address'] : '';
$phone = isset( $instance['phone'] ) ? $instance['phone'] : '';
$fax = isset( $instance['fax'] ) ? $instance['fax'] : '';
$email = isset( $instance['email'] ) ? $instance['email'] : '';
// Before Widget.
echo $args['before_widget'];
if ( $title ) {
echo $args['before_title'] . $title . $args['after_title'];
} ?>
'text',
'id' => 'title',
'name' => __( 'Title:', 'astra-widgets' ),
'default' => ( isset( $instance['title'] ) && ! empty( $instance['title'] ) ) ? $instance['title'] : '',
),
array(
'name' => 'Style',
'id' => 'style',
'type' => 'select',
'default' => ( isset( $instance['style'] ) && ! empty( $instance['style'] ) ) ? $instance['style'] : 'stack',
'options' => array(
'inline' => __( 'Inline', 'astra-widgets' ),
'stack' => __( 'Stack', 'astra-widgets' ),
),
),
array(
'type' => 'checkbox',
'id' => 'display-icons',
'name' => __( 'Display Icons?', 'astra-widgets' ),
'default' => ( isset( $instance['display-icons'] ) && ! empty( $instance['display-icons'] ) ) ? $instance['display-icons'] : false,
),
array(
'type' => 'textarea',
'id' => 'address',
'name' => __( 'Address:', 'astra-widgets' ),
'default' => ( isset( $instance['address'] ) && ! empty( $instance['address'] ) ) ? $instance['address'] : '',
),
array(
'type' => 'text',
'id' => 'phone',
'name' => __( 'Phone:', 'astra-widgets' ),
'default' => ( isset( $instance['phone'] ) && ! empty( $instance['phone'] ) ) ? $instance['phone'] : '',
),
array(
'type' => 'text',
'id' => 'fax',
'name' => __( 'FAX:', 'astra-widgets' ),
'default' => ( isset( $instance['fax'] ) && ! empty( $instance['fax'] ) ) ? $instance['fax'] : '',
),
array(
'type' => 'text',
'id' => 'email',
'name' => __( 'Email:', 'astra-widgets' ),
'default' => ( isset( $instance['email'] ) && ! empty( $instance['email'] ) ) ? $instance['email'] : '',
),
);
// Generate fields.
astra_generate_widget_fields( $this, $fields );
}
}
endif;