[Gutenberg Starter Theme] Try pulling starter content in from an external file #16
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR tries out an idea that came up during a discussion with @epiqueras yesterday — that starter content could theoretically be pulled in from a standalone "block template"-style file, rather than being declared as a complicated array in PHP, as is done in themes like this repo's version of Twenty Twenty.
This PR creates a new
block-starter-content
folder for the Gutenberg Starter Theme (Blocks). It contains apost-demo.html
file, full of the content from Gutenberg's demo post. This content gets pulled into the homepage viafile_get_contents()
for now. I'm not sure if that's the right function, or if it needs to be escaped and/or limited in some way... I could see this being problematic if the file size were huge. But it appears to work for this example at least. I'd love some more experienced PHP 👀 on that method.To test:
Gutenberg Starter Theme (Blocks)
into your site’s themes directory.The homepage should now contain the demo content from
block-starter-content/post-demo.html
.Screenshot