158 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,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
+3 more
M-Theme says

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

1290 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
158 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,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!

1290 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
+3 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.

158 posts I think about colours
  • Located in Greece
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $250,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
+3 more
M-Theme says

Please see the new version of woocommerce plugin.

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by