153 posts I think about colours
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
  • Greece
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!

137 posts
  • Elite Author
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Referred between 10 and 49 users
M-Theme says

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

1081 posts
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Referred between 50 and 99 users
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
+1 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
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
  • Greece
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!

1081 posts
  • Forum Superstar
  • Most Wanted Bounty Winner
  • Envato Studio (Microlancer) Beta Tester
  • Author had a Free File of the Month
  • Bought between 50 and 99 items
  • Referred between 50 and 99 users
  • Europe
  • Has been a member for 3-4 years
  • Exclusive Author
+1 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.
137 posts
  • Elite Author
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Referred between 10 and 49 users
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
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Has been a member for 4-5 years
  • Bought between 100 and 499 items
  • Referred between 100 and 199 users
  • Exclusive Author
  • Greece
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.

137 posts
  • Elite Author
  • Exclusive Author
  • Has been a member for 2-3 years
  • Sold between 100 000 and 250 000 dollars
  • Bought between 50 and 99 items
  • Referred between 10 and 49 users
M-Theme says

Please see the new version of woocommerce plugin.

by
by
by
by
by
by