• Hi All,

    I have just turned on WP_DEBUG to test something, and I noticed that one of my widgets, which is working fine btw, has thrown some errors:

    Notice: Undefined variable: before_widget in /wordpress/wp-content/themes/interio/functions/widgets/widget-contactform-support.php on line 24

    Notice: Undefined variable: after_widget in /wordpress/wp-content/themes/interio/functions/widgets/widget-contactform-support.php on line 112

    This is how I build my widget (which again is working fine):

    class Form_Widget_wpse_104728 extends WP_Widget {
    //Defining the widget
    
    function widget($args,$instance) {
        echo $before_widget;
    
    // Processing the form
         - Php code for sending email
    //The Form itself
         - HTML code for support form
    
        echo $after_widget;
    } //Ending function widget
    } //ending widget class

    Is there anything wrong with the widget itself that could cause this error?

    Thanks in advance! ??

Viewing 1 replies (of 1 total)
  • function widget($args,$instance) {
    
        extract($args);
    
        echo $before_widget;
    
        // Processing the form
    
        echo $after_widget;
    }

    make sure to extract arguments first to use sidebar configuration. hope it help.

Viewing 1 replies (of 1 total)
  • The topic ‘[Widget] When using WP_DEBUG: Undefined variable before_widget’ is closed to new replies.