woocommerce / woosidebars

Replace registered sidebars in your WordPress themes using different conditions such as a specific page, a category or even an individual blog post.
https://wordpress.org/plugins/woosidebars/
51 stars 42 forks source link

#38 Fix Notice Undefined index : templates in Conditions #39

Closed vincsb closed 8 years ago

vincsb commented 9 years ago

I resolve the issue #38 which i can reproduce in four steps :

  1. Install latest Wordpress version
  2. Activate a theme with no page template (example : twentyfifteen)
  3. Download and activate Woosidebars
  4. Go to Apparence > Widgets Areas > Add new

You can find a PHP notice in the conditions metabox : "Notice: Undefined index: templates in /.../wp-content/plugins/woosidebars/classes/class-woo-conditions.php on line 582"

It's because an empty array with 'templates' key is create before check if there is templates page in the theme. I just move this declaration, it's a minor change.

I test my change with a template page, no error.

vincsb commented 9 years ago

I follow the contribution guidelines, but I think I made a mistake to pull my request on branch release-1-4-0. I had not seen that this branch is 4 commit behind master.

It's ok for you or you want me to clean it ? :)

vburlak commented 8 years ago

also have the same issue. @mattyza, please merge that pull-request

mattyza commented 8 years ago

@vincsb @vburlak I'll clean this and cherry-pick the commit.

Thanks for submitting! :)

vincsb commented 8 years ago

@mattyza @vburlak Glade i could help !

vburlak commented 8 years ago

@mattyza thx a lot

mattyza commented 8 years ago

I found a slightly different solution for this, gents. I've added and tagged version 1.4.3 which contains this solution. :)