1 | <?php |
---|
2 | |
---|
3 | class example_widget extends WP_Widget { |
---|
4 | public function __construct() { |
---|
5 | $widget_ops = array('classname' => 'My_Widget', 'description' => My widget demonstration' ); |
---|
6 | $this->WP_Widget('My_Widget', 'My Widget', $widget_ops); |
---|
7 | } |
---|
8 | |
---|
9 | function form($instance) { |
---|
10 | $defaults = array( |
---|
11 | 'title' => 'My Widget', |
---|
12 | 'message' => '<i class="icon"></i> This I tag is the source of the problem' |
---|
13 | ); |
---|
14 | |
---|
15 | $instance = wp_parse_args($instance, $defaults); |
---|
16 | |
---|
17 | $title = esc_attr($instance['title']); |
---|
18 | $message = esc_attr($instance['message']); |
---|
19 | |
---|
20 | ?> |
---|
21 | <p> |
---|
22 | <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label> |
---|
23 | <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; ?>" /> |
---|
24 | </p> |
---|
25 | <p> |
---|
26 | <label for="<?php echo $this->get_field_id('message'); ?>"><?php _e('Message'); ?></label> |
---|
27 | <input class="widefat" id="<?php echo $this->get_field_id('message'); ?>" name="<?php echo $this->get_field_name('message'); ?>" type="text" value="<?php echo $message; ?>" /> |
---|
28 | </p> |
---|
29 | <?php |
---|
30 | } |
---|
31 | } |
---|
32 | |
---|
33 | ?> |
---|