• Hello, I’ve created a theme based on Underscores and I’m recommending Custom Sidebars via TGM. Anyway, I encountered a debug notice when I was switching from my theme to Twenty Fifteen:

    ( ! ) Notice: Undefined index: cs-2 in /Users/blahblahblah/wp-content/plugins/custom-sidebars/inc/class-custom-sidebars-replacer.php on line 142

    I can see the notice because I’m developing with WP_DEBUG turned on. But you guys might also want to address this minor issue.

    Thanks

    https://www.ads-software.com/plugins/custom-sidebars/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @bfintal,

    Thanks for posting on the forum.

    I have tested it on my test site using latest version of Custom Sidebars plugin and setting wp debug to true.

    I switched Twenty Fifteen theme and many others but didn’t get any notice.

    Are you getting this notice only when switching from your theme to Twenty Fifteen?

    This can also be due to other plugins so when testing please try temporary deactivating all other plugins.

    Please advise.

    Kind Regards,
    Vinod Dalvi

    Thread Starter Benjamin Intal

    (@bfintal)

    What I did was I activated my theme, created my new widget areas, replaced the original sidebars (everything was working fine). Afterwards I changed my theme and got the error notice.

    It’s also showing up in the live preview ??

    I’m using a standard setup with WP 4.1 and the latest Custom Sidebars

    Thread Starter Benjamin Intal

    (@bfintal)

    Lastly, when I delete the previously created sidebars, the errors finally go away.

    Hi @bfintal,

    I hope you’re well today! Thanks for those extra details, I’ve been trying to replicate this one and just can’t seem to as yet.

    I’ve got a site where debugging is turned on, I create multiple sidebars, configure them, switch themes multiple times, but still no error message.

    Could you please confirm that you’re seeing that when switching between default themes like TwentyFourteen and TwentyFifteen?

    Looking forward to getting that sorted with ya! ??

    Cheers,
    David

    Thread Starter Benjamin Intal

    (@bfintal)

    You know what, I just tried to document the whole process I previously did when I saw the error. I can’t seem to make it appear again. I can’t replicate either.

    However, it would be great if an additional check was made to prevent any similar errors from happening again in that line of code. I reckon an if ( ! empty( ... ) ) { ... } statement should fix it. A fix for that would be greatly appreciated.

    Hi @bfintal,

    Thank you for your feedback.

    I still couldn’t reproduce the issue on my test site but i also think there should be the check on line number 142 in the following Custom Sidebar plugin file as displayed below.

    Custom Sidebar plugin file:
    custom-sidebars/inc/class-custom-sidebars-replacer.php

    Before Editing :

    if ( sizeof( $original_widgets[$replacement] ) == 0 ) {

    After Editing :

    if ( !empty($original_widgets[$replacement]) && sizeof( $original_widgets[$replacement] ) == 0 ) {

    I have notified the plugin developer to add this check in the plugin file and i hope it will be added in the future version of plugin.

    In the meanwhile if you face this issue again then try using the above fix.

    Cheers,
    Vinod Dalvi

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Debug notice when switching themes’ is closed to new replies.