-
Notifications
You must be signed in to change notification settings - Fork 676
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
[CMSP-695] WordPress 6.5 font library documentation and behavior #8867
Merged
Merged
Changes from 7 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
53b2f18
add draft release notes for WP 6.5 font library
jazzsequence 54bfb9c
add a guide under WordPress Configuration that talks about the WP Fon…
jazzsequence c9fd5e9
rename the release note with the expected release date
jazzsequence 566fe6a
remove nonfunctional links
jazzsequence bdfd875
add g'berg issue
jazzsequence c553ffa
update notes to maintain consistency
jazzsequence 57a787f
update publish date
jazzsequence 8fd3bf2
add troubleshooting info if the FS is not writeable
jazzsequence 9a22682
some copy changes
jazzsequence d4bf296
fix image url
jazzsequence 8c6a938
add new screenshots
jazzsequence 6bea7f4
update info about handling fonts like media files
jazzsequence e96cdde
update troubleshooting steps
jazzsequence ed2505c
add one more troubleshooting Q & A
jazzsequence e36ddb2
specify in the admin
jazzsequence c7e9a09
Be more clear that this only happens if you've changed the Pantheon s…
jazzsequence 252e896
remove references to "restoring wp default behavior"
jazzsequence ad83d54
note how we prioritized our filter
jazzsequence 0b97b88
add details to how 'active' fonts work
jazzsequence ad65671
update copy about post type
jazzsequence 0785575
simplify language
jazzsequence 8ced605
more simplification
jazzsequence 5968b20
clarify introductory paragraph
jazzsequence aef5e79
discuss (new) wp default behavior and why we're keeping our mu-plugin…
jazzsequence db1d125
remove note, this is no longer an issue
jazzsequence ad0a5af
update language about overriding our font_dir filter
jazzsequence b48a981
add our G'berg issue for font handling for manual uploads
jazzsequence e356c02
add link to more resources
jazzsequence 46922b2
remove release notes for wp 6.5 from this PR
jazzsequence 657c4b2
remove link to release post (that doesn't exist)
jazzsequence 1186cd9
Merge branch 'main' into cmsp-695-6.5-font-library-docs
jazzsequence 64c1337
add new plugin tag for PAPC release note
jazzsequence 529e57f
add a new release note for the MU plugin release
jazzsequence ceedeba
note when developing locally
jazzsequence 82d259d
remove unrelated release note update
jazzsequence File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
source/content/guides/wordpress-configurations/07-wordpress-font-library.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
title: WordPress Configurations Guide | ||
subtitle: Using the WordPress Font Library on Pantheon | ||
description: Understand how to use the WordPress Font Library on Pantheon and how to restore the WordPress default behavior. | ||
contenttype: [guide] | ||
innav: [false] | ||
categories: [config] | ||
cms: [wordpress] | ||
audience: [development] | ||
product: [--] | ||
integration: [plugins] | ||
tags: [workflow, code] | ||
contributors: [jazzsequence] | ||
permalink: docs/guides/wordpress-configurations/wordpress-font-library | ||
--- | ||
|
||
This section provides information on how to use the WordPress Font Library on Pantheon. | ||
|
||
[WordPress 6.5 (release name)]() introduced a new [Font Library]() feature. This feature allows you to upload fonts to your WordPress site or install any of the fonts available from Google's font library. In anticipation of this, Pantheon added a feature to our [Pantheon MU Plugin](https://github.com/pantheon-systems/pantheon-mu-plugin) to store those fonts in a writeable `wp-content/uploads/fonts/` directory, so that you can use the feature without any issues after updating your sites to 6.5. This changed the default WordPress core behavior of storing fonts in `wp-content/fonts` which would require committing fonts to your site repository and deploying them from dev to test to live. | ||
|
||
## Using the Filter | ||
|
||
If you want to use the default WordPress behavior and store fonts in `wp-content/fonts`, you can use the following filter: | ||
|
||
```php | ||
add_filter( 'pantheon_modify_fonts_dir', '__return_false' ); | ||
``` | ||
|
||
Put this code somewhere in your site codebase as a plugin, in a theme `functions.php` file or in a [custom mu-plugin](https://docs.pantheon.io/guides/wordpress-configurations/wordpress-custom-code). This will restore the original behavior and commit fonts to your site repository. | ||
|
||
You can _change the directory_ where fonts are stored by using the WordPress core filter `font_dir` like this: | ||
|
||
```php | ||
add_filter( 'font_dir', function( $defaults ) { | ||
$font_dir = '/path/to/your/custom/dir'; | ||
$font_url = site_url( $font_dir ); | ||
|
||
$defaults['path'] = $font_dir; | ||
$defaults['url'] = $font_url; | ||
$defaults['basedir'] = $font_dir; | ||
$defaults['baseurl'] = $font_url; | ||
|
||
return $defaults; | ||
} ); | ||
``` | ||
|
||
<Alert title="Note" type="info"> | ||
|
||
You cannot use the function `wp_get_upload_dir()` inside the `font_dir` filter because it will cause an infinite loop. Instead, if you want to use the `wp_get_upload_dir()` function, you can use a global variable as [we do in our mu-plugin](https://github.com/pantheon-systems/pantheon-mu-plugin/blob/main/inc/fonts.php) or [remove the filter and then re-add it](https://github.com/WordPress/wordcamp.org/pull/1245/files#diff-e441f1053cefcd468bd20fed91d1aac5e902871d7c564be909fc35590f9c3082R635-R637). | ||
|
||
For more information, refer to [this Gutenberg issue](https://github.com/WordPress/gutenberg/issues/58696). | ||
|
||
</Alert> | ||
|
||
## Considerations | ||
|
||
The distinction between the two approaches for handling fonts depends what works best for your workflow and whether you consider your fonts to be handled more like media files or more like themes and plugins. | ||
|
||
**If you consider fonts to be more like media files**, use the default Pantheon behavior added in our `mu-plugin`. This makes it easier to _install fonts onto production sites_ but perhaps more difficult to _synchronize_ those fonts on the lower environments (test and dev). | ||
|
||
**If you consider fonts to be more like themes and plugins**, use the WordPress default behavior and the `pantheon_modify_fonts_dir` filter. This ensures that the fonts are installed across environments, but does not necessarily mean that fonts that are _physically installed_ on your lower environments (e.g. they exist in the `wp-content/fonts` directory) are recognized by WordPress. (They may still need to be added in the WordPress admin.) | ||
|
||
## More Resources | ||
* [Font Library Gutenberg Tracking Ticket](https://github.com/WordPress/gutenberg/issues/55277) | ||
jazzsequence marked this conversation as resolved.
Show resolved
Hide resolved
|
jazzsequence marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
title: WordPress 6.5 (release name) Release | ||
published_date: "2024-03-26" | ||
categories: [wordpress] | ||
--- | ||
|
||
The latest version of WordPress, [6.5 (release name)](), became available on Pantheon as of March 26, 2024. | ||
|
||
<h3>Highlights</h3> | ||
|
||
* WordPress 6.5 introduces the new [Font Library](). This feature allows you to upload fonts to your WordPress site or install any of the fonts available from Google's font library. | ||
* By default, WordPress will store these fonts into the `wp-content/fonts` directory. On Pantheon, this directory is not writeable on live sites. We have added a feature to our [Pantheon MU Plugin](https://github.com/pantheon-systems/pantheon-mu-plugin) to store those fonts in a writeable `wp-content/uploads/fonts/` directory, so that you can use the feature without any issues after updating your sites to 6.5. | ||
* If you would like to restore the original behavior and commit fonts to your site repository, refer to our [documentation](/guides/wordpress-configurations/wordpress-font-library). |
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the default Pantheon filter, do fonts move between environments with a "clone files" workflow as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a few things I need to test. That's one. I also have a couple open questions that I posted in
#core-editor
Slack: https://wordpress.slack.com/archives/C02QB2JS7/p1707937998405009There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I smashed that subscribe button for more jazzsequence gutenberg goodness.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's what I'm seeing:
So, to answer your question, it does appear that they are pulled down when you clone the DB and files (I suspect you would need to clone the DB and files in order to get them), but there is an additional step to actually use them on the lower environment you pulled down to. I will update the doc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And, to be clear, I think the "active" value is similar to Plugin/Theme "activation", meaning it's there it's just not "available". It's similar, I believe, to the fact that when I cloned down my DB and files from Live to Dev, my FSE theme was active, but the specific theme style that I was using on Live was not selected on Dev.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's curious that activation status doesn't carry through db clone the way plugin activation status would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm not sure what this tells me exactly, because surely these settings are stored in the database somewhere, but whatever the full site editor is doing with styles, it's doing the same thing with fonts.
¯\_(ツ)_/¯