• When you got (production environment) set WP_DEBUG to true in wp-config.php, you get a lot of undefined index, because the widget ain’t got any default values. A fast hack is adding the following lines to form() function at between line 139 & 140. Btw: Every Widget should have defaults imho.

    // defaults
    	if(!isset($instance["title"])) { $instance["title"] = 'insert title here'; }
    	if(!isset($instance["cat"])) { $instance["cat"] = 'allgemein'; }
    	if(!isset($instance["num"])) { $instance["cat"] = '5'; }
    	if(!isset($instance["title_link"])) { $instance["title_link"] = false; }
    	if(!isset($instance["excerpt"])) { $instance["excerpt"] = false; }
    	if(!isset($instance["excerpt_length"])) { $instance["excerpt_length"] = '25'; }
    	if(!isset($instance["comment_num"])) { $instance["comment_num"] = false; }
    	if(!isset($instance["date"])) { $instance["date"] = false; }
    	if(!isset($instance["thumb"])) { $instance["thumb"] = false; }
    	if(!isset($instance["thumb_w"])) { $instance["thumb_w"] = '40'; }
    	if(!isset($instance["thumb_h"])) { $instance["thumb_h"] = '30'; }

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Franz Josef Kaiser

    (@f-j-kaiser)

    Edit: Pls edit line 3 to your default category title. Currently it’s the german wp edition default title.

    Thread Starter Franz Josef Kaiser

    (@f-j-kaiser)

    sry. too fast. just don’t use it when WP_DEBUG = true

    aaahaaap

    (@aaahaaap)

    These notices still show when WP_DEBUG=true
    Please use isset in your code or set (sane) defaults.

    (Don’t understand FJ Kaiser’s comment about not using it, no piece of code should cause warnings or notices)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘[Plugin: Category Posts Widget] no defaults = undefined index’ is closed to new replies.