defaults = array( 'title' => '', 'alignment' => 'left', 'user' => '', 'size' => '45', 'author_info' => '', 'page' => '', 'page_link_text' => __( 'Weiter lesen', 'ah_about' ) . ' »', ); $widget_ops = array( 'classname' => 'user-profile', 'description' => __( 'Zeigt eine kleine "Über mich" Box mit dem Autor-Gravatar in der Sidebar an.', 'ah_about' ), ); $control_ops = array( 'id_base' => 'user-profile', 'width' => 200, 'height' => 250, ); $this->WP_Widget( 'user-profile', __( 'AH About Widget', 'ah_about' ), $widget_ops, $control_ops ); // Load css only when widget is active if ( is_active_widget( false, false, $this->id_base, true ) ) { // Make function pluggable if (! function_exists('ah_about_css')) { function ah_about_css() { wp_enqueue_style( 'about-me', plugins_url( '/css/style.css', __FILE__ ) ); } } } add_action( 'wp_enqueue_scripts', 'ah_about_css' ); } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { extract( $args ); /** Merge with defaults */ $instance = wp_parse_args( (array) $instance, $this->defaults ); echo $before_widget; echo "
"; echo $after_widget; } public function form( $instance ) { /** Merge with defaults */ $instance = wp_parse_args( (array) $instance, $this->defaults ); ?>
'authors', 'name' => $this->get_field_name( 'user' ), 'selected' => $instance['user'] ) ); ?>
$this->get_field_name( 'page' ), 'show_option_none' => __( 'Keine', 'ah_about' ), 'selected' => $instance['page'] ) ); ?>