-
Notifications
You must be signed in to change notification settings - Fork 32
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
New blueprint: use wp cli to add a post with a featured image #27
Conversation
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Co-authored-by: Adam Zielinski <[email protected]>
@adamziel Thank you so much for the correction of directories and the wp-cli command. To test it before the merge use this link |
Nice going with the validity check on the PR! |
Updated the directories to use 'https://raw.githubusercontent.com/adamziel/blueprints/trunk/blueprints/' |
@bph The problem with the https://raw.githubusercontent.com/adamziel/blueprints/trunk/blueprints/cli-markdown/postcontent.md URL is that it will work after merging, but it makes previewing the PR impossible as there isn't anything at that URL yet – it just return 404. The URL pointing to your branch, https://raw.githubusercontent.com/adamziel/blueprints/cli-markdown/blueprints/wpcli-markdown/postcontent.md, returns the correct file. The problem now is – once we merge this PR and delete the branch, it will start returning 404. I've reconciled this dualism recently with a repository automation that rewrites branch-specific URLs to trunk URLs. The automation verifies your PR only contains URLs pointing to your branch, and once we merge, it will update your Blueprint to point to trunk. I also documented this in CONTRIBUTING.md. LMK what do you think, I haven't found a better solution yet. |
I just confirmed that, after merging, the preview link in the Gallery document works as expected: https://github.com/adamziel/blueprints/blob/trunk/GALLERY.md |
The goal:
This way one could create a playground instance with some test instructions right on the site.
There are a few challenges, I haven't figured out.
The write file step I tried both /wordpress/wp-content/uploads and /wp-content/uploads
Error message:
config-cb0d0260.js:631 Error: Could not write to "/wp-content/uploads/postcontent.md": There is no such file or directory OR the parent directory does not exist.
And I am not sure how to point wp-cli to the file to grab it and write it in a post.
The image part is also tricky.
Locally, I can use this
- wp media import ~/azblueprints/blueprints/wpcli-markdown/Select-storage-method.png --post_id=56 --title="Select your storage method" --featured_image
WordPress then created the media library directory, placed the file with all the image sizes and created db attachment post.