WordPress / wporg-mu-plugins

Development of the Global Header and other mu-plugins used on WordPress.org.
58 stars 28 forks source link

Port old `header.php` features etc #42

Closed iandunn closed 2 years ago

iandunn commented 2 years ago

port any needed "features" from old header

header.php

functions-global.php

dd32 commented 2 years ago

skip to content links.

Looking for other uses of the skip-to link in our themes shows that a number of themes have a variant on it, and some don't even place the skip link at the start of the document (developer.w.org for example is between the header and the content that it then skips to)

Temporarily handled that via https://github.com/WordPress/wordpress.org/commit/ab3eed116dde78c45620e66cf88e028db7cac2e1

We'll still need to handle that with the other header "options" stuff.

text direction

New header takes care of those already.

download mobile

https://github.com/WordPress/wordpress.org/commit/e9708fa487cbff6fc60037c3f560f83e197d54c6

google analytics

Taken care of via https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/wp-content/mu-plugins/pub/wporg-google-tag-manager.php

X-Olaf

Olaf he shall; It's time for him to retire from WordPress.org

<body id="wordpress-org" - is this needed?

Looks like it's being used in the Gutenberg theme as a super hard-level heading override selector: https://github.com/WordPress/wordpress.org/blob/trunk/wordpress.org/public_html/wp-content/themes/pub/gutenberg/style.css#L1102-L1114

Can't find it in Codex.

Also used by the subscription widget: https://github.com/WordPress/wordpress.org/commit/35309f618e9370352d5e1abda63f140cdc41eb5a#diff-359f1279063b3388ff9cc37db057279e2cb4c5e96b7950d15a75381466aea6d4R1879-R1885

We can remove that ID.

dd32 commented 2 years ago

functions-global.php

capital P - is this for menu items that rosetta/etc admins create? might be cleaner to filter wp_get_nav_menu_items() or whatever, rather than buffering in this file

That predates a lot of things, IIRC it might be related to forum data? I think we should just remove it and fix it elsewhere when it comes up by hooking the proper function within WordPress.

301 redirect - still needed?

The catch-all hostname one can probably go.. It's handled either by nginx or Multisite network-not-found/site-not-found.

The index.php one will need to remain in some form, probably moved to the other canonical ruleset on dotorg.

menu generation not needed anymore?

Sounds right to me.

maybe port some of the localization stuff, but in a cleaner way

The fetch-custom-header stuff in there is for bbPress 1.x use of the header on localised sites, of which there should be none anymore. That should be ditchable.

dd32 commented 2 years ago

codex-specific stuff?

There's a few placeholders we need to output in the appropriate places for MediaWiki: <!-- [codex head html] -->, <!-- [codex head meta] -->, <!-- [codex head scripts] -->

We need to ensure that this style is loaded: <link rel="stylesheet" href="//s.w.org/style/codex-wp4.css?3" />.

There's also a // Opt codex into responsive styling. function which can be removed, the responsive styles it enables really don't do much anymore.

I'll test how the Codex will function with the new header & footer next week (I have a test environment for it).

dd32 commented 2 years ago

$pagetitle global in Themes, Rosetta, GlotPress.

The majority of that has been taken care of via: https://github.com/WordPress/wordpress.org/commit/8caf64970c82d7b28e942121cf93952ba31f8802 https://github.com/WordPress/wordpress.org/commit/3f5740fae06205615c31583b042da4d4ff2c4224 https://github.com/WordPress/wordpress.org/commit/407e0b3dd999345da6b1e989966b954226bd3a4f

dd32 commented 2 years ago

I'm calling this issue almost done. header.php is starting to look rather bland.

capital P - is this for menu items that rosetta/etc admins create? might be cleaner to filter wp_get_nav_menu_items() or whatever, rather than buffering in this file

I think we can probably remove this global filter and attach the WP variant to the the_content and comment_text filters instead on all sites with UGC instead. The buffer filter was mostly to catch UGC (Forum posts, Plugin & Theme descriptions, etc), I suspect it was done as a output buffer purely to catch all the various apps that were running on dotorg.

dd32 commented 2 years ago

I think we can probably remove this global filter and attach the WP variant to the the_content and comment_text filters

In core, it's applied to...'the_content', 'the_title', 'wp_title', 'document_title', 'comment_text', 'widget_text_content'.

In bbPress, it's additionally applied to 'bbp_get_reply_content', 'bbp_get_topic_content'.

On developer.w.org, it's specifically removed from comment_text. On translate.w.org, it's applied to saved translations.

I think it's safe to disable. Done in r18322-dotorg.