'', 'acmephoto_author_image' => '', 'acmephoto_author_link' => '', 'acmephoto_author_new_window' => 1, 'acmephoto_author_short_disc' => '', ); function __construct() { parent::__construct( /*Base ID of your widget*/ 'acmephoto_author', /*Widget name will appear in UI*/ __('AT Author', 'acmephoto'), /*Widget description*/ array( 'description' => __( 'Add author with different options.', 'acmephoto' ), ) ); } /*Widget Backend*/ public function form( $instance ) { /*merging arrays*/ $instance = wp_parse_args( (array) $instance, $this->defaults); $acmephoto_author_title = esc_attr( $instance['acmephoto_author_title'] ); $acmephoto_author_image = esc_url( $instance['acmephoto_author_image'] ); $acmephoto_author_link = esc_url( $instance['acmephoto_author_link'] ); $acmephoto_author_new_window = esc_attr( $instance['acmephoto_author_new_window'] ); $acmephoto_author_short_disc = esc_attr( $instance['acmephoto_author_short_disc'] ); ?>

> <?php _e( 'Image preview', 'acmephoto' ); ?>

/>


defaults); $acmephoto_author_title = apply_filters( 'widget_title', $instance['acmephoto_author_title'], $instance, $this->id_base ); $acmephoto_author_image = esc_url( $instance['acmephoto_author_image'] ); $acmephoto_author_link = esc_url( $instance['acmephoto_author_link'] ); $acmephoto_author_new_window = esc_attr( $instance['acmephoto_author_new_window'] ); $acmephoto_author_short_disc = wp_kses_post( $instance['acmephoto_author_short_disc'] ); echo $args['before_widget']; if ( !empty($acmephoto_author_title) ) { echo $args['before_title'] . $acmephoto_author_title . $args['after_title']; } $ad_content_image = ''; if ( ! empty( $acmephoto_author_image ) ) { /*creating add*/ $img_html = ''; $link_open = ''; $link_close = ''; if ( ! empty( $acmephoto_author_link ) ) { $target_text = ( 1 == $acmephoto_author_new_window ) ? ' target="_blank" ' : ''; $link_open = ''; $link_close = ''; } $ad_content_image = $link_open . $img_html . $link_close.$acmephoto_author_short_disc; } if ( !empty( $ad_content_image ) ) { echo '
'; echo $ad_content_image; echo '
'; } echo $args['after_widget']; } } endif; if ( ! function_exists( 'acmephoto_author_widget' ) ) : /** * Function to Register and load the widget * * @since 1.0 * * @param null * @return void * */ function acmephoto_author_widget() { register_widget( 'Acmephoto_author_widget' ); } endif; add_action( 'widgets_init', 'acmephoto_author_widget' );