Options for discontinued theme

InFocus WordPress Theme is discontinued.

The site suddenly is throwing a 500 error.

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

Hi

If you have access to server settings or are working on a local server, you can try changing some PHP options yourself in the php.ini file:

  • Set both post_max_size and upload_max_filesize to be larger than the theme file.
  • Ensure memory_limit is generous (256M is recommended).

Also you can try in this way. Open your website root wp-config.php and add the following line at top:

define('WP_MEMORY_LIMIT', '256M');

Thanks!

That is a great idea. I will definitely give that a try.

I recently migrated to a new server so this makes so much sense.

I’ll post back about results.

Thanks so much!

Hi. Oh dear, I really thought that would work. I uploaded a user.ini file with the following:

max_execution_time = 180
max_input_vars = 1500
upload_max_filesize = 32M
post_max_size=32M
memory_limit = 256M

The error says the site can’t handle the request.

user.ini WRONG FILE name. Please contact hosting they will support you.

have you tried => Open your website root wp-config.php and add the following line at top:

define(‘WP_MEMORY_LIMIT’, ‘256M’);

Thanks!

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.

First, thank you so much for your help.

Line 302 is blank but please see the code on line 203 - which I found from the error file.

There is a “$this->” there. But the “&” before the dollar sign looks weird to me.

“add_filter( ‘mysite_blog_sc_meta’, array( &$this, ‘post_meta’ ) );”

Would I replace “&$this” with “static::” ?

/**
	 * Loads theme filters.
	 *
	 * @since 1.0
	 */
	function filters() {
		
		# Mysitemyway filters
		add_filter( 'mysite_avatar_size', create_function('','return "60";' ) );
		add_filter( 'mysite_additional_posts_title', create_function('','return;' ) );
		add_filter( 'mysite_read_more', 'mysite_read_more' );
		add_filter( 'mysite_blog_sc_meta', array( &$this, 'post_meta' ) );
		add_filter( 'mysite_widget_meta', 'mysite_widget_meta' );

Sorry! I meant line 203.

Yeah, something strange is happening here. To try for an immediate fix, find this line from your snippet:

	add_filter( 'mysite_blog_sc_meta', array( &$this, 'post_meta' ) );

Then change it to this:

	add_filter( 'mysite_blog_sc_meta', array( isset($this) ? $this : new static, 'post_meta' ) );

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.

1 Like

Oh my goodness. Now I can access the pages. You are brilliant. I could cry. :sweat_smile:

Now I can at least see what the pages look like. I was also able to login to the WordPress Admin Area.

I’ll go back to the owner of this site and tell him we need to migrate to a supported theme. Are you an author?

Here is the code around line 25. Like from line 10 to line 29.

class Mysitemyway {

/**
 * Initializes the theme framework by loading
 * required files and functions for the theme.
 *
 * @since 1.0
 */
public static function init( $options ) {
	self::constants( $options );
	self::functions();
	self::extensions();
	self::classes();
	self::variables();
	self::actions();
	self::filters();
	self::supports();
	self::locale();
	self::admin();
}
1 Like

That’s great to hear! :smiley:

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.

Glad to have helped! Cheers!

Thank you so much for explaining about the PHP. I’m sure that is exactly what happened.

You really saved me. I was so lost.

I really can’t thank you enough. I wish you the very best of luck and I’m sure you’ll be very successful at whatever you do.

Best regards.

2 Likes

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.

This topic was automatically closed after 2 days. New replies are no longer allowed.