-
Notifications
You must be signed in to change notification settings - Fork 0
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
WordPress in the browser #241
Comments
WordPress Playground can be used to install the inseri core plugin via the zip archive. |
One can export the content using Tools -> Export and import it in a similar way to the playground. For the local Wordpress deployment the experience was good. |
https://wasm.wordpress.net/ allows to even download the state and upload it back. You can try to upload the next one ... and in the worst example we will ask the users to do this initial manual step. |
See WordPress/wordpress-playground#88 for the on-going work. |
👋 @aplamada you could set up an HTML page that uses WordPress Playground public API to install and configure the plugin for the user: <!DOCTYPE html>
<html>
<head>
<title>WordPress Playground</title>
</head>
<body>
<iframe id="wp" style="width: 1200px; height: 800px"></iframe>
<script type="module">
import { connectPlayground, login, installPlugin } from 'https://unpkg.com/@wp-playground/client/index.js';
const client = await connectPlayground(
document.getElementById('wp'),
{ loadRemote: 'https://playground.wordpress.net/remote.html' }
);
await client.isReady();
await login(client, 'admin', 'password');
// Assuming inseri.zip is hosted with this HTML file:
const response = await fetch('./inseri.zip');
const inseriFile = new File([await response.blob()], 'inseri.zip');
await installPlugin( client, inseriFile );
// Redirect to the right landing page
await client.goTo( '/wp-admin/' );
</script>
</body>
</html> It might take a while to load so you may want to implement a minimal progress bar to make the wait a better experience. Here's how GlotPress Playground did it: https://github.com/akirk/wp-glotpress-playground/blob/main/index.php Keep in mind https://playground.wordpress.net/remote.html isn't a stable API yet and might have breaking changes at one point. Hopefully not many, but still. If you need a no-maintenance-involved experience, you can host your own WordPress Playground instance. |
@adamziel Many thanks for the instructions. So far I managed to use the Dockerfile from ADD input /input
RUN cd wordpress && \
../wp-cli.phar --allow-root plugin install /input/inseri-core.zip && \
../wp-cli.phar --allow-root plugin activate inseri-core
RUN cd wordpress && \
../wp-cli.phar --allow-root post delete $(../wp-cli.phar --allow-root post list --post_type='page,post' --format=ids) &&\
../wp-cli.phar --allow-root import /input/inseriswiss.WordPress.xml --authors=skip &&\
../wp-cli.phar --allow-root post delete $(../wp-cli.phar --allow-root post list --post_type='page' --format=ids)
I still have to learn what to do next. I was thinking whether it would be possible to use GitHub Pages to host my Playground. Do you see any limitations? |
Oh that Dockerfile builds a highly optimized I'd recommend not starting there. Instead, you could use the WordPress Playground public API. That's what the HTML file I posted above does. There's some documentation here and here with more to come. In a nutshell, you can embed Playground inside an However if you'd like to use a local Playground, you'd still use the same public API. The only difference would be the iframe pointing to Let me know if that answers some of your questions. If not, I'm happy to keep answering :-) |
I tried that initially! I found that downloading 2MB of data from GitHub pages ( The only real limitation is that Playground uses a network proxy written in PHP. It's only used if you want to install plugins or themes from WordPress.org directory. If you don't need that, GitHub pages will work. |
Thanks @adamziel ! But for my particular use case, it would be convenient to have a way to import some posts from the public WordPress (already exported as a WXR XML file). Do you know how to achieve this? |
Yay! I'm super glad to hear that
In a recent PR I merged a In addition, I'm working on a Playground Blueprint format that will allow you to import a WXR file by just specifying its URL :) |
@adamziel Thanks! I start using the Playground Blueprint and it works as desired - so far without importing the WXR but I plan to try it in the near future. |
WordPress Playground can be one way to allow any person to test inseri.
The plugin following could be installed following the documentation - see Installing plugins.
This is additional to an WP instance that the early adopters can test.
The text was updated successfully, but these errors were encountered: