153 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+3 more
SkatDesign says

Hey,

With the new WP update I’ve got a problem with one of the plugins I’m using (sidebar generator): Strict Standards: Non-static method sidebar_generator::name_to_class() should not be called statically in

If I declare the function static it says that the function cannot be static. If I try to use ”$this” it says that it is used outside the object context.

Anyone had the same problem and found a fix?

Cheers!

138 posts
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+2 more
M-Theme says

If you use ”$this”, you should change the “function sidebar_generator()”, to “function __construct()”.

1185 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+5 more
Smartik says
Create the function:
public static name_to_class(){
...
}
Call the function:
self::name_to_class();//inside of your class

or

sidebar_generator::name_to_class();//this can be used in or out of your class
153 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+3 more
SkatDesign says

Thanks for your answers, but:

@MattMao: thank you, that fixed it. I also had to change the actions array to &$this and everything worked fine.

@Smartik: already tried that but it says that the functions cannot be declared static.

Cheers!

1185 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+5 more
Smartik says

@Smartik: already tried that but it says that the functions cannot be declared static.
Strange because I got the same errors after wordpress upgrade and they were all fixed by public static in front of all functions. But I guess that’s because I’ve changed to the constructor from PHP 5.
138 posts
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+2 more
M-Theme says

Thanks for your answers, but:

@MattMao: thank you, that fixed it. I also had to change the actions array to &$this and everything worked fine.

@Smartik: already tried that but it says that the functions cannot be declared static.

Cheers!

Hi, Skat!

I think useing ”$this” is better.

153 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
+3 more
SkatDesign says

Hi, Skat!

I think useing ”$this” is better.

Hmm, but I’ve seen everywhere plugin devs. using “&$this” in WP plugins. Even in a TUTSPLUS tutorial.

Can you elaborate a little bit why is it better?

Cheers and thanks again for your time.

138 posts
  • Has referred 10+ members
  • Has sold $75,000+ on Envato Market and is now an Elite Author
  • Has collected 50+ items on Envato Market
  • Elite Author: Sold more than $75,000 on Envato Market
+2 more
M-Theme says

Please see the new version of woocommerce plugin.

by
by
by
by
by
by