Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* ---------------------------------------------------------------------*/
- /* Follow Me Widget */
- class dg_followWidget extends WP_Widget {
- /** constructor */
- function dg_followWidget() {
- $followwidget_ops = array( 'classname' => 'widget_text', 'description' => __('Link to your twitter page for viewers to follow you.'));
- $control_ops = array('width' => 200);
- parent::WP_Widget(false, $name = 'Follow Me', $followwidget_ops, $control_ops);
- }
- /** @see WP_Widget::widget */
- function widget($args, $instance) {
- extract( $args );
- $title = apply_filters('widget_title', $instance['title']);
- $username = apply_filters('widget_text', $instance['username']);
- ?>
- <li id="follow-me" class="widget-container">
- <?php if ( $title ) echo $before_title . $title . $after_title; ?>
- <?php if ( $title ) ?>
- <div class="follow-username">
- <span class="twit-icon" style="margin-right: 5px;">
- <img src="http://twitter-badges.s3.amazonaws.com/t_mini-b.png" height="15px" width="15px"/>
- </span>
- <a href="http://www.twitter.com/#!/<?php echo $username; ?>" target="_blank"><?php echo $username; ?></a>
- </div>
- </li>
- <?php
- }
- /** @see WP_Widget::update */
- function update($new_instance, $old_instance) {
- $instance = $old_instance;
- $instance['title'] = strip_tags($new_instance['title']);
- $instance['username'] = strip_tags($new_instance['username']);
- return $instance;
- }
- /** @see WP_Widget::form */
- function form($instance) {
- $title = esc_attr($instance['title']);
- $username = esc_attr($instance['username']);
- ?>
- <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
- <br/>
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" />
- <br/>
- <br/>
- <label for="<?php echo $this->get_field_id('username'); ?>"><?php _e('Username:'); ?></label>
- <br/>
- <input class="code widefat" id="<?php echo $this->get_field_id('username'); ?>" name="<?php echo $this->get_field_name('username'); ?>" type="text" value="<?php echo $username; ?>" />
- <span class="description">without @</span>
- <?php
- }
- } // class quoteWidget
- // register quoteWidget widget
- add_action('widgets_init', create_function('', 'return register_widget("dg_followWidget");'));
- /* ---------------------------------------------------------------------*/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement