• Resolved dralezero

    (@dralezero)


    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

    (@dralezero)

    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.