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

How to update Theme AND Plugin? #503

Open
fredchandler opened this issue Oct 17, 2022 · 3 comments
Open

How to update Theme AND Plugin? #503

fredchandler opened this issue Oct 17, 2022 · 3 comments

Comments

@fredchandler
Copy link

Hello,
using the code

require get_template_directory() . '/inc/plugin-update-checker/plugin-update-checker.php'; $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker( 'exampleurl.com/theme.json', __FILE__, //Full path to the main plugin file or functions.php. 'slug' );

works ok to update themes from an external resource.

But i want to know how to, or what is the correct code to get updates from theme AND plugins (both hosted on external urls).
if i add another url below the first json url file with "plugin.json" i get an obvious error.

thanks

@YahnisElsts
Copy link
Owner

Technically, you can just make a copy of the $myUpdateChecker = Puc_v4_Factory::buildUpdateChecker(...) code, change the variable name and the arguments, and put it below the theme update checker code.

I think the code that updates a plugin usually goes in the plugin and not in the theme, but you can put it in the theme if you want. Just make sure to provide the correct path to the main plugin file - __FILE__ won't work if the code isn't actually in the plugin file.

@YahnisElsts
Copy link
Owner

@AhmadRaza9 It looks like your comment is not related to this issue. If you have a separate problem, please create a new issue.

(And, to save you some time: make sure that your plugin directory is not open in some application - console, IDE, Git/SVN software - while you're trying to install an update.)

@AhmadRaza9
Copy link

@YahnisElsts

okay Thanks

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

3 participants