YahnisElsts / wp-update-server

A custom update API for WordPress plugins and themes. Intended to be used in conjunction with my plugin-update-checker library.
MIT License
824 stars 176 forks source link

where I have to put example-theme.zip and which class is correct ? #97

Closed Alireza-Ghavabesh closed 3 years ago

Alireza-Ghavabesh commented 3 years ago
  1. my question is, where I have to put example-theme.zip ? in the packages directory? I also like to say that when I place example-theme.zip in packages directory in wp-update-server and check this url : (http://localhost/wp-update-server/?action=get_metadata&slug=example-theme) in the browser, I receive this response json in browser: { "name": "example-theme", "version": "1.8", "homepage": "http://localhost/example-theme/", "author": "the WordPress team", "author_homepage": "http://localhost/", "details_url": "http://localhost/my-theme-changelog/my-theme-changelog.html", "last_updated": "2021-05-21 11:24:06", "slug": "example-theme", "download_url": "http://localhost/wp-update-server/?action=download&slug=example-theme", "request_time_elapsed": "0.018" }
  2. which class is correct ? (Puc_v4_Factory::buildUpdateChecker or ThemeUpdateChecker) for functions.php in my example-theme

thankyou alot

YahnisElsts commented 3 years ago
  1. Yes, put the ZIP file in the packages directory. If you're getting a valid JSON response, the ZIP file is probably already in the right place.
  2. Puc_v4_Factory::buildUpdateChecker() is the more recent version. ThemeUpdateChecker is outdated and no longer maintained. It might still work, but I would not recommend using it in new projects.
Alireza-Ghavabesh commented 3 years ago

currently my example-theme have a Enable auto-update & Disable auto-update Button but although my theme version is: 2.0 and new updated theme in server (in packages folder) is 2.1 but there is no yellow notification for updating theme !

can you tell me what is my mistake ?! ![Uploading Screenshot (45).png…]()

YahnisElsts commented 3 years ago

Your screenshot isn't showing up for some reason. However, based on the JSON that you posted earlier, the version on the server is 1.8, not 2.1. Are you sure you have the latest version in the packages directory? It might still have an older file, or the version number in the file is incorrect.

Alireza-Ghavabesh commented 3 years ago

Screenshot (46)

Screenshot (47)

I'm very surprised, everything looks ok ...!

YahnisElsts commented 3 years ago

That looks OK to me, too. The version numbers are correct, and the fact that the JSON response shows the new version means that the ZIP file is in the right place.

Could it be that the code that sets up the update checker is wrong? Please make sure that it has the right URL, file name and theme slug.

Alireza-Ghavabesh commented 3 years ago

Screenshot (48)

YahnisElsts commented 3 years ago

I think that looks fine. And this theme is active, yes?

If it still doesn't work, try installing the Debug Bar plugin and look at he "PUC (example-theme)" panel in the debug bar. Does it show the correct information for your theme? You can also try manually triggering an update check (there should be a button for that in the panel) and see what happens.

Alireza-Ghavabesh commented 3 years ago

tnx tnx !

all of my problem fixed and it worked very well !

just i have a questions:

I want to set an icon for my notification. 781ec2f1-0f9d-41bd-8bdb-570d5fecc5ea like that in the screenshot I will be grateful if you can give me a link contain some guide about customizing and prettify yellow notification.

thanck you very much

YahnisElsts commented 3 years ago

That looks like a custom icon that was probably added by another plugin or theme. I don't know how it was done. This update checker doesn't have a feature like that. It just lets WordPress core generate the notifications.