Making WordPress.org

Opened 4 years ago

Last modified 20 months ago

#5759 new enhancement

Support Forums: Improve local environment support

Reported by: clorith's profile 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)

5759.patch (1.8 KB) - added by Clorith 4 years ago.
5759.2.patch (888 bytes) - added by Clorith 4 years ago.

Download all attachments as: .zip

Change History (10)

@Clorith
4 years ago

#1 @Clorith
4 years ago

  • Keywords has-patch added

@Clorith
4 years ago

#2 @Clorith
4 years ago

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 the package.json. This allows contributors to use grunt directly from the project dependencies, instead of needing to install it globally.

#3 @dd32
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 @Clorith
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?)

#5 @dd32
3 years ago

In 11581:

Support Forums: Improve local dev environment by adding the grunt script runner.

Props Clorith.
See #5759.

#6 @dd32
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 @Clorith
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.

This ticket was mentioned in Slack in #forums by vladytimy. View the logs.


20 months ago

Note: See TracTickets for help on using tickets.