What options do I have to fix the error which is probably one PHP change in one file?
I want to get the theme working before moving to a new theme. It is a very small, non-commercial site.
Thanks for any ideas as I’m stumped and not an expert coder.
Thanks, April
Here is the error thrown:
[10-Oct-2019 15:30:41 UTC] PHP Warning: Declaration of mysiteDescriptionWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/lib/classes/menu-walker.php on line 45
[10-Oct-2019 15:30:41 UTC] PHP Warning: Declaration of mysiteResponsiveMenuWalker::start_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::start_lvl(&$output, $depth = 0, $args = Array) in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/lib/classes/menu-walker.php on line 87
[10-Oct-2019 15:30:41 UTC] PHP Warning: Declaration of mysiteResponsiveMenuWalker::end_lvl(&$output, $depth) should be compatible with Walker_Nav_Menu::end_lvl(&$output, $depth = 0, $args = Array) in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/lib/classes/menu-walker.php on line 87
[10-Oct-2019 15:30:41 UTC] PHP Warning: Declaration of mysiteResponsiveMenuWalker::start_el(&$output, $item, $depth, $args) should be compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args = Array, $id = 0) in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/lib/classes/menu-walker.php on line 87
[10-Oct-2019 15:30:41 UTC] PHP Warning: Declaration of mysiteResponsiveMenuWalker::end_el(&$output, $item, $depth) should be compatible with Walker_Nav_Menu::end_el(&$output, $item, $depth = 0, $args = Array) in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/lib/classes/menu-walker.php on line 87
[10-Oct-2019 15:30:41 UTC] PHP Fatal error: Uncaught Error: Using $this when not in object context in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/framework.php:203
Stack trace: #0 /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/framework.php(25): Mysitemyway::filters() #1 /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/functions.php(19): Mysitemyway::init(Array) #2 /ROOT/ACCOUNT/public_html/webproject-center/wp-settings.php(479): include(’/ROOT/ACCOUNT/…’) #3 /ROOT/ACCOUNT/public_html/webproject-center/wp-config.php(80): require_once(’/ROOT/ACCOUNT/…’) #4 /ROOT/ACCOUNT/public_html/webproject-center/wp-load.php(37): require_once(’/ROOT/ACCOUNT/…’) #5 /ROOT/ACCOUNT/public_html/webproject-center/wp-blog-header.php(13): require_once(’/ROOT/ACCOUNT/…’) #6 /ROOT/ACCOUNT/public_html/webproject-center/index.php(17): require(’/ROOT/ACCOUNT/…’) #7 {main}
thrown in /ROOT/ACCOUNT/public_html/webproject-center/wp-content/themes/infocus/framework.php on line 203
Go to line 302 of the file at /wp-content/themes/infocus/framework.php. Look for “$this->” and replace it with “static::”.
For example, if the line said:
return ($this->doSomethingAwesome());
You would change it to:
return (static::doSomethingAwesome());
It is interesting that this only just now started happening. This should have always caused an error, so something deeper is definitely going on here. But doing the above may be enough to jump start it back up.
This could get your site working again, but it won’t fix the underlying problem. If you still have an error after making the change above, can you post the code around line 25 of that same file? That line might be the origin.
It looks like this error was ultimately caused by a mixture of faulty code and a recent PHP upgrade. The error you were receiving was only added to PHP after 7.1.0, so you must have been running an older version up to that point. Your host might have upgraded the version for you if you aren’t aware of any changes in that area.
The code fix I provided should suffice for now, but definitely consider finding a theme that is designed for modern PHP versions.
And sorry – while I am an author, I don’t have any themes for sale.
I have issues with inFocus too. With one of the WP updates, it seems to have broken the short tags for fancy_images. All the images just spin but don’t load on the site. Any ideas on what to look at!? If i click on the spinner the full size image does load.