GavickPro / GK-News-Show-Pro

Advanced widget for the posts display.
GNU General Public License v2.0
9 stars 9 forks source link

Notice: Undefined index: use_css in .../plugins/gk-nsp/gk-nsp.php on line 342 #10

Closed szakee closed 10 years ago

szakee commented 10 years ago

Hi! I set the "Use default css" to off in all widget.

If the define('WP_DEBUG', true); in the wp-config file I get this messege: Notice: Undefined index: use_css in .../plugins/gk-nsp/gk-nsp.php on line 342

This is that row:

if(
                $instance['use_css'] == 'on' && 

So, I replaced for this:

 if( isset($instance["use_css"]) AND 
                $instance['use_css'] == 'on' &&
dziudek commented 10 years ago

Hello,

Do you have the following fragment in the gk-nsp.php file:

class GK_NewsShowPro_Widget extends WP_Widget {
    // variable used to store the object configuration
    public $config = array(
        'title' => '',
        'widget_css_suffix' => '',
        'use_css' => 'on',
szakee commented 10 years ago

Thank you Tomasz!

Yes, it does, but the message is still present.

dziudek commented 10 years ago

Are you using the newest version of the plugin from the repository? Because as I see you have a different line numbers.

szakee commented 10 years ago

Yes, I downloaded today, that line number in the first comment is in an older version. Now the message is: Notice: Undefined index: use_css in .../wp-content/plugins/gk-nsp/gk-nsp.php on line 355 But this is fixed for me:

if( isset($instance["use_css"]) AND 
   $instance['use_css'] == 'on' &&
dziudek commented 10 years ago

I'll analyze this case and as soon as fixed version will be available I'll inform you :)

dziudek commented 10 years ago

This commit should solve your problems: https://github.com/GavickPro/GK-News-Show-Pro/commit/e54c6143daeef746c09330b914dded1f31cfeb8c

szakee commented 10 years ago

I checked. The php notice is gone now, but is look like load the default css anyway. About the default css switch. This is a great option, but if I have more NSP widget in same page then enough if just one is set default css on, that override the another NSP widgets css setting on the particular page. It's important to me, how my theme users use the theme css for the NSP widgets. Can I avoid this if I using a custom css suffix, and I add it this suffix to my custom css? Or maybe I can add a new custom option to the framework what is deregister the widget default css. I just wondering.

dziudek commented 10 years ago

The easies way in your case will be opening the gk-nsp.php file and changing line:

'use_css' => 'on',

to:

'use_css' => 'off',

Then in all new instances after creating the using of default CSS will be defaultly disabled.

szakee commented 10 years ago

Oh, yes. That is much simplier :) Thanks