Opened 4 years ago
Last modified 20 months ago
#5759 new enhancement
Support Forums: Improve local environment support
Reported by: | Clorith | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Component: | Support Forums | Keywords: | has-patch |
Cc: |
Description
Currently the foums theme (and many other meta elements really), rely on the global header and footer fetched via a call to require WPORGPATH . 'header.php
and require WPORGPATH . 'footer.php'
respectively.
The global header is not open sourced, so to be able to replicate the environment locally, one would need to do something like define( 'WPORGPATH', 'https://wordpress.org/' )
and enable allow_url_fopen
in PHP.
This works, but the header is then not aware of any enqueued assets or other scripts in the local environment that may need to trigger.
The attached patch adds a check if the header or footer actions have been ran in the support theme after requiring these global files, and will call wp_head()
and wp_footer()
if not.
Attachments (2)
Change History (10)
#3
@
4 years ago
The wporg
theme which is intended on being used as a "base theme" provides a fall-back for the header/footer, could this be merged with that approach instead?
Unfortunately not all themes use that as the theme template, but I think it'd be worthwhile considering.
#4
@
4 years ago
That's a thought indeed, and I agree with you that sounds like a much cleaner solution if there's already a fallback in there.
(probably something worth checking if can be done on a grander scale for all themes when possible to ease the process for others as well?)
#6
@
3 years ago
I committed 5759.2.patch but with the new WordPress.org header, composer will be required to load the new headers and stuff.
See https://github.com/WordPress/pattern-directory/commit/8e5528e21055c89f61129033807d1a63395d6504 for a change that added it to the pattern directory.
This probably means the simplest option will be to spin up an environment similar to https://github.com/wordpress/theme-directory-env
#7
@
3 years ago
Completely agree that this makes more sense to do as a local environment setup now.
I've been tinkering with it today, and ended up with https://github.com/Clorith/support-forums. This is sort of a combination of the theme and pattern directories, with some forums sprinkled on top, happy to transfer it over just give me a ping :)
Ideally, having something set up to push changes for forum-assets to dotorg would be beneficial, so this doesn't need to be manually updated either which way, but MVP's and proof of concept is a good start I think.
In addition to 5759.patch providing the header and footer code as mentioned, 5759.2.patch improves local development by adding a
grunt
script runner to thepackage.json
. This allows contributors to use grunt directly from the project dependencies, instead of needing to install it globally.