Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught Error: Class 'ThemeUpdateChecker' not found ? #67

Open
unijez opened this issue Oct 8, 2018 · 3 comments
Open

Uncaught Error: Class 'ThemeUpdateChecker' not found ? #67

unijez opened this issue Oct 8, 2018 · 3 comments

Comments

@unijez
Copy link

unijez commented Oct 8, 2018

I'm trying to get this running but using the documentation and adding in the below along with including plugin-update-checker files i get the following error...

Fatal error: Uncaught Error: Class 'ThemeUpdateChecker' not found in C:\inetpub\wwwroot\wordpress1\wp-content\themes\ myBlog\functions.php :204 \wp-content\themes\ myBlog\functions.php on line 204

etc etc etc
`
if ( file_exists( get_template_directory() . '/inc/plugin-update-checker/plugin-update-checker.php' ) ) {

require get_template_directory() .  '/inc/plugin-update-checker/plugin-update-checker.php';
$MyThemeUpdateChecker = new ThemeUpdateChecker(
	'schoolsUOL', //Theme slug. Usually the same as the name of its directory.
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8' //Metadata URL.
);

}
`

@YahnisElsts
Copy link
Owner

That part of the documentation is for the old, unmaintained theme update checker library. It sounds like you're using the more recent plugin-update-checker library instead. That's a good thing, but the new library requires slightly different initialisation code. Here's an example:

$MyThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8',
	__FILE__, //Full path to functions.php.
	'schoolsUOL'
);

By the way, I would recommend using all-lowercase slugs for your theme(s). A while ago there were reports about a WP bug that could interfere with AJAX update installation when the slug contained uppercase characters. I'm not sure if that has been fixed yet.

@unijez
Copy link
Author

unijez commented Oct 8, 2018

That part of the documentation is for the old, unmaintained theme update checker library. It sounds like you're using the more recent plugin-update-checker library instead. That's a good thing, but the new library requires slightly different initialisation code. Here's an example:

$MyThemeUpdateChecker = Puc_v4_Factory::buildUpdateChecker(
	'https://mysite.co.uk//wp-update-server/?action=get_metadata&slug=myBlog-1.0.8',
	__FILE__, //Full path to functions.php.
	'schoolsUOL'
);

By the way, I would recommend using all-lowercase slugs for your theme(s). A while ago there were reports about a WP bug that could interfere with AJAX update installation when the slug contained uppercase characters. I'm not sure if that has been fixed yet.

Thank you.

Would it be okay to use &slug=myBlog rather than a version prefix, otherwise there would be no point in releasing an update because i would have to change that line of code in each functions file running the theme?

@YahnisElsts
Copy link
Owner

Would it be okay to use &slug=myBlog rather than a version prefix

Of course. The slug in the URL basically just determines which file in the packages directory the server will look at. So you could rename myBlog-1.0.8.zip to myBlog.zip and then use &slug=myBlog.

Just to clarify, when I was talking about lowercase slugs, I meant this part: schoolsUOL. The slug parameter in the metadata URL doesn't have to be lowercase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants