'bavotasan_custom_text_widget', 'description' => __( 'Custom Text Widget with Image', 'ward' ) ); $control_ops = array('width' => 400, 'height' => 350); parent::__construct( 'bavotasan_custom_text_widget', '(' . BAVOTASAN_THEME_NAME . ') ' . __( 'Image & Text', 'ward' ), $widget_ops, $control_ops ); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); } function admin_enqueue_scripts( $hook ) { if ( 'widgets.php' == $hook ) { wp_enqueue_media(); wp_enqueue_script( 'bavotasan_image_widget', BAVOTASAN_THEME_URL . '/library/js/admin/image-widget.js', array( 'jquery', 'media-upload', 'media-views' ), '', true ); wp_enqueue_style( 'bavotasan_image_widget_css', BAVOTASAN_THEME_URL . '/library/css/admin/image-widget.css' ); } } function widget( $args, $instance ) { extract( $args ); $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? '' : $instance['title'], $instance, $this->id_base ); $image = esc_url( $instance['image'] ); $text = apply_filters( 'widget_text', empty( $instance['text'] ) ? '' : $instance['text'], $instance ); $url = esc_url( $instance['url'] ); $title_string = ( $url ) ? ''. $title . '' : $title; $image_string = ( $url ) ? '' . esc_attr( $title ) . '' : '' . esc_attr( $title ) . ''; echo $before_widget; if ( ! empty( $image ) ) echo $image_string; if ( $title ) echo $before_title . $title_string . $after_title; ?>
'', 'text' => '', 'image' => '', 'url' => '' ) ); extract( $instance ); $img_tag = ( $image ) ? '' : ''; ?>

|

/>