nerdydrew / Random-Pokemon-Generator

Source code for randompokemon.com
https://randompokemon.com
GNU General Public License v2.0
81 stars 27 forks source link

Creating a WP-Plugin #11

Open Zavi499 opened 1 week ago

Zavi499 commented 1 week ago

Its not exactly an issue but a question , how can i convert this into WP-Plugin?

nerdydrew commented 1 week ago

WP being WordPress? This fork might be a good starting point—it makes a REST API that you could use in a plugin. For WordPress, I believe you would need a PHP back end. I don't know if it's easy to add NodeJS or if you would need to run it somewhere else and have the WordPress plugin be a client.

Alternatively, you could start from the generateRandom() method in src/random.js. The important calls from there are getEligiblePokemon and chooseRandom. If you want this all in plain JavaScript without any NodeJS, you would need PHP to render and call JavaScript like that.