Plugin Directory

Changeset 599157


Ignore:
Timestamp:
09/15/2012 03:05:03 AM (13 years ago)
Author:
graphical_force
Message:

Added the option to style the widget using a css class.

Location:
get-user-info/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • get-user-info/trunk/getUserInfo.php

    r597324 r599157  
    3636        extract( $args );
    3737        $title = apply_filters( 'widget_title', $instance['title'] );
     38        $cssClass = apply_filters('widget_title', empty($instance['cssClass']) ? '' : $instance['cssClass'], $instance);
    3839        $user = apply_filters( 'widget_title', $instance['userName'] );
     40        if ( $cssClass ) {
     41            if( strpos($before_widget, 'class') === false ) {
     42                $before_widget = str_replace('>', 'class="'. $cssClass . '"', $before_widget);
     43            } else {
     44                $before_widget = str_replace('class="', 'class="'. $cssClass . ' ', $before_widget);
     45            }
     46        }
    3947
    4048        $user = get_userdatabylogin($user);
     
    6977        $instance['userName'] = strip_tags( $new_instance['userName'] );
    7078        $instance['title'] = strip_tags($new_instance['title']);
     79        $instance['cssClass'] = strip_tags($new_instance['cssClass']);
    7180
    7281        return $instance;
     
    8493            $userName = $instance[ 'userName' ];
    8594            $title = $instance['title'];
     95            $cssClass = strip_tags($instance['cssClass']);
    8696        }
    8797        else {
     
    92102        <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ); ?></label>
    93103        <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" />
     104        </p>
     105        <p>
     106        <label for="<?php echo $this->get_field_id('cssClass'); ?>"><?php _e('CSS Class:'); ?></label>
     107        <input class="widefat" id="<?php echo $this->get_field_id('cssClass'); ?>" name="<?php echo $this->get_field_name('cssClass'); ?>" type="text" value="<?php echo esc_attr($cssClass); ?>" />
    94108        </p>
    95109        <p>
  • get-user-info/trunk/readme.txt

    r597328 r599157  
    19192. Activate the plugin through the 'Plugins' menu in WordPress
    20203. Add a Get User Info widget to any sidebar and add a title if needed then add the user name of the user you want to display. You can also display the user info by using the following shortcode '[authorinfo user="User Name"]' (replace User Name with the user name that you want to display ex. [authorinfo user="Bill"])
     214. Add a css class that will allow you to style the widget if you want.
    2122
    2223== Changelog ==
     24
     25= 1.0.3 =
     26* Added the css class functionality to the widget.
    2327
    2428= 1.0.2 =
Note: See TracChangeset for help on using the changeset viewer.