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

Docs/Guides: WordPress Playground for plugin developers #1750

Conversation

juanmaguitar
Copy link
Collaborator

@juanmaguitar juanmaguitar commented Sep 11, 2024

This PR addresses #1664

This PR belong to a set of three guides that are meant to be published together

Note: There was an older version of this PR at #1745 that was closed

Copy link
Collaborator

@bph bph left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a great guide!
I do have a few comments and suggestions.
We definitely need to make sure we adhere to the external link policies of the documentation team, regarding linking to personal GitHub repos. It's not a blocker for the first version, though.


The WordPress Playground is an innovative tool that allows plugin developers to build, test and showcase their plugins directly in a browser environment.

This guide will explore **how you can leverage the WordPress Playground to enhance your plugin development workflow, create live demos to showcase your WordPress plugin to the world, and streamline your plugin testing process**.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bolding beyond a few words is super distracting, and when it's two lines, it kind of looses the emphasize and blends just in.


### Plugin in the WordPress themes directory

With WordPress Playground, you can quickly launch a WordPress installation with any plugin available in the [WordPress Plugins Directory](https://wordpress.org/plugins/) installed and activated. Simply pass the `plugin` [query parameter](/developers/apis/query-api) to the [Playground URL](https://playground.wordpress.net) like this: https://playground.wordpress.net/?plugin=gutenberg.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"any" mean every plugin, and that's probably not the case. I would feather it with 'almost any'

I think this would need a bit more explanations, as a plugin developer might not have read the other pages in the documentation.

"All you need to do is add 'plugin' as a query parameter to the URL and use the slug of the plugin from the WordPress directory as value" It might be better illustrated with a multi-word plugin slug like
https://playground.wordpress.net/?plugin=create-block-theme

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"any" mean every plugin, and that's probably not the case. I would feather it with 'almost any'

What do you mean by this? Is there any case that you know of of a plugin published in the WordPress Plugins Directory that cannot be loaded in a WordPress Playground instance?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, there are quite a few because they need additional PHP modules or other additional configurations. It might be going down, but you can't assume that every plugin works with Playground.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Thanks for the clarification.
I'll add the almost any 👍

"path": "/wordpress/wp-content/plugins/0-plugin.php",
"data": {
"resource": "url",
"url": "https://gist.githubusercontent.com/ndiego/456b74b243d86c97cda89264c68cbdee/raw/ff00cf25e6eebe4f5a4eaecff10286f71e65340b/block-hooks-demo.php"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a blocker:
We should adhere to the external links policies of the documentation team, and not link to personal GitHub spaces.
Maybe that Gist can be moved to the /wptrainingteam, too or can be brought over to the blueprints gallery repo.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree, but AFAIK gists are only available under GitHub users and not organizations. Is there any "WordPress user " we could use for this?
In this case, maybe we need to blend the external links policies a little bit in order to show this capability of WP Playground. This example is taken from an example in the Blueprints Gallery

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In a different blueprint example, the file was uploaded to the directory of the examples. Maybe we can modify that examples.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have changed the displayed example to use the file at the Blueprints Gallery GitHub repo and added a tip callout referencing the example in the GitHub Gallery creating a plugin from the code in a gist

Some useful tools and resources provided by the Playground project to work with blueprints are:

- Check the [Blueprints Gallery](https://github.com/WordPress/blueprints/blob/trunk/GALLERY.md) to explore real-world code examples of using WordPress Playground to launch a WordPress site with a variety of setups.
- The [WordPress Playground Step Library](https://akirk.github.io/playground-step-library/#) tool provides a visual interface to drag or click the steps to create a blueprint for WordPress Playground. You can also create your own steps!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, not a blocker, but as soon as you add the Playground Step Library to the official documentation, it also becomes official. There should be a plan to bring the Playground Step Library to the /WordPress organization, even if it's just a experimental repo.

Copy link
Collaborator Author

@juanmaguitar juanmaguitar Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good point, but I'm not sure, it should stop us from sharing valuable resources with the community at this stage.

There are a lot of "non-official" resources recommended from the Links and Resources section. For example, the https://github-proxy.com/ tool itself is also not part of the /WordPress organization.

I would open a broader conversation about this, but in the meantime I would continue sharing as many helpful resources we can to ease the work with WordPress Playground.

cc: @adam

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said, it's not a blocker to this PR, but I do feel strongly to at least try to bring these tools inside WordPress as soon as possible. It adds to the credibility and the increases developer trust. It shouldn't be too difficult to adhere to the policy as we are all in those spaces anyway.

Copy link
Collaborator Author

@juanmaguitar juanmaguitar Sep 12, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

at least try to bring these tools inside WordPress as soon as possible

I agree 🤝


:::

Through properties and [`steps`](/blueprints/steps) in the Blueprint, you can configure the Playground instance's initial setup, providing your plugins with the content and configuration needed for proper showcasing.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"(...) and configuration needed for proper showcasing" seems to lack a noun, and proper might not be the right word....
Try something like this:
"(... and configuration needed for showcasing your plugin's compelling features and functionality."

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds much better. Thanks!


:::info

One thing you may want to do to provide a good demo with WordPress Playground is to load default content to better showcase the features of your plugin or theme. Check out the [Providing content for your demo](/guides/providing-content-for-your-demo) guide to learn more
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sentence feels a bit to long... Something like this might tighten it up a bit:
"A great demo with WordPress Playground, might require that you load default content for your plugin and theme."


### `writeFile`

With the `writeFile` step you can create on the fly any plugin file taking the code from a file stored on a GitHub repo or a gist.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try: "With the writefile step you can create any plugin file on the fly, referencing code from a *.php file stored on a GitHub or Gist."


### Local plugin development and testing with Playground

From a plugins' folder in your local development environment, you can quickly load locally a Playground instance with that plugin loaded and activated. You can do that by launching, in the plugin's directory, the [`wp-now` command](/developers/local-development/wp-now) from your preferred command line program or the [Visual Code Studio extension](/developers/local-development/vscode-extension) from the [Visual Studio Code](https://code.visualstudio.com/) IDE.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"With WP-Now, you can quickly load a Playground instance locally from a plugin's folder, with that plugin loaded and activated. Use the wp-now command from the command line of your plugin's root directory. "

..Not sure whether that's better...

@juanmaguitar
Copy link
Collaborator Author

Thanks for your feedback @bph
I have applied some of your suggestions and asked a bit more about others.

bgrgicak pushed a commit that referenced this pull request Sep 12, 2024
As both #1664
and #1663
require info about how to provide content for a demo in Playground I
think it's best to create a separate guide with this topic that can be
referenced from these guides

This PR belong to a set of three guides that are meant to be published
together
- WordPress Playground for Theme Developers
#1732
- WordPress Playground for Plugin Developers
#1750
- Providing content for your demo
#1747
…ress-juanmaguitar/wordpress-playground into docs/guide-for-plugin-developers-2
bgrgicak pushed a commit that referenced this pull request Sep 12, 2024
This PR addresses
#1663

This PR belong to a set of three guides that are meant to be published
together
- WordPress Playground for Theme Developers
#1732
- WordPress Playground for Plugin Developers
#1750
- Providing content for your demo
#1747
@juanmaguitar juanmaguitar merged commit 2d08573 into WordPress:trunk Sep 12, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants