Catchresponsive_social_icons_widget

Adds catchresponsiveSocialIcons widget.

Defined (1)

The class is defined in the following location(s).

/inc/catchresponsive-widgets.php  
  1. class Catchresponsive_social_icons_widget extends WP_Widget { 
  2.  
  3. /** 
  4. * Register widget with WordPress. 
  5. */ 
  6. function __construct() { 
  7. parent::__construct( 
  8. 'catchresponsive_social_icons', // Base ID 
  9. __( 'CT: Social Icons', 'catch-responsive' ), // Name 
  10. array( 'description' => __( 'Use this widget to add Social Icons as a widget. ', 'catch-responsive' ) ) // Args 
  11. ); 
  12.  
  13. /** 
  14. * Front-end display of widget. 
  15. * @see WP_Widget::widget() 
  16. * @param array $args Widget arguments. 
  17. * @param array $instance Saved values from database. 
  18. */ 
  19. public function widget( $args, $instance ) { 
  20. $title = isset( $instance['title'] ) ? $instance['title'] : ''; 
  21.  
  22. echo $args['before_widget']; 
  23.  
  24. if ( ! empty( $title ) ) 
  25. echo $args['before_title'] . $title . $args['after_title']; 
  26.  
  27. echo catchresponsive_get_social_icons(); 
  28.  
  29. echo $args['after_widget']; 
  30.  
  31. /** 
  32. * Back-end widget form. 
  33. * @see WP_Widget::form() 
  34. * @param array $instance Previously saved values from database. 
  35. */ 
  36. public function form( $instance ) { 
  37. if ( isset( $instance['title'] ) ) { 
  38. $title = $instance['title']; 
  39. else { 
  40. $title = ''; 
  41. ?> 
  42. <p> 
  43. <label for="<?php echo $this->get_field_name( 'title' ); ?>"><?php _e( 'Title (optional):', 'catch-responsive' ); ?></label> 
  44. <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 ); ?>" /> 
  45. </p> 
  46. <?php 
  47.  
  48. /** 
  49. * Sanitize widget form values as they are saved. 
  50. * @see WP_Widget::update() 
  51. * @param array $new_instance Values just sent to be saved. 
  52. * @param array $old_instance Previously saved values from database. 
  53. * @return array Updated safe values to be saved. 
  54. */ 
  55. public function update( $new_instance, $old_instance ) { 
  56. $instance = array(); 
  57. $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? strip_tags( $new_instance['title'] ) : ''; 
  58. return $instance; 
  59.  
  60.