Title: Create two widgets in plugin with WP_Widget
Last modified: August 19, 2016

---

# Create two widgets in plugin with WP_Widget

 *  Resolved [dralezero](https://wordpress.org/support/users/dralezero/)
 * (@dralezero)
 * [16 years ago](https://wordpress.org/support/topic/create-two-widgets-in-plugin-with-wp_widget/)
 * I have two different widgets I want to be available when someone installs my 
   plugin. I made one widget with
    `class MYWIDGET extends WP_Widget { //everything
   here }` then
 *     ```
       function widget_MYWIDGET_init() {register_widget('MYWIDGET');}
       add_action('widgets_init', 'widget_MYWIDGET_init');
       ```
   
 * I tried duplicating the whole class then doing another register_widget but it
   isn’t working. Also tried doing another init function and add_action

Viewing 1 replies (of 1 total)

 *  Thread Starter [dralezero](https://wordpress.org/support/users/dralezero/)
 * (@dralezero)
 * [16 years ago](https://wordpress.org/support/topic/create-two-widgets-in-plugin-with-wp_widget/#post-1476335)
 * I figured it out. You can simply duplicate the whole process in the same plugin
   file. I just overlooked not having this part unique between the two.
 * `$this->WP_Widget('yawQuestions',...`

Viewing 1 replies (of 1 total)

The topic ‘Create two widgets in plugin with WP_Widget’ is closed to new replies.

## Tags

 * [wp_widget](https://wordpress.org/support/topic-tag/wp_widget/)

 * 1 reply
 * 1 participant
 * Last reply from: [dralezero](https://wordpress.org/support/users/dralezero/)
 * Last activity: [16 years ago](https://wordpress.org/support/topic/create-two-widgets-in-plugin-with-wp_widget/#post-1476335)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
