-
Notifications
You must be signed in to change notification settings - Fork 10.7k
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
Add Cardo
and Inter
fonts to global styles via theme json filter
#47417
Conversation
@@ -26,6 +26,7 @@ class ComingSoonRequestHandler { | |||
final public function init( ComingSoonHelper $coming_soon_helper ) { | |||
$this->coming_soon_helper = $coming_soon_helper; | |||
add_filter( 'template_include', array( $this, 'handle_template_include' ) ); | |||
add_filter( 'wp_theme_json_data_theme', array( $this, 'filter_theme_json_theme' ) ); |
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.
Feels awkward to have this in coming soon class since it'll be available for the entire site. Would it be ok temporarily? Or should we generalize for Woo core usage?
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.
Could we check that woocommerce_coming_soon == 'yes'
or that the current page being viewed is coming soon or the template?
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.
@psealock I tried by checking the current page to site-editor.php
and the current template, it worked to not load in non-coming soon page. However, due to the way site editor works, the loaded fonts persists even when we switch between templates, which means once we load coming soon page, the fonts will carry through other pages as well 😞
I don't think limiting the font load in site editor will be viable
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.
Would it be ok temporarily? Or should we generalize for Woo core usage?
I think it's fine to have it in the coming soon class for now. We can always refactor it later if needed.
however, due to the way site editor works, the loaded fonts persists even when we switch between templates, which means once we load coming soon page, the fonts will carry through other pages as well
That makes sense. 😞
As @psealock suggested, could we check that woocommerce_coming_soon == 'yes'
? That way, we can ensure that the fonts are only loaded when the coming soon mode is enabled.
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 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 see. That makes sense!
Test using WordPress PlaygroundThe changes in this pull request can be previewed and tested using a WordPress Playground instance. Test this pull request with WordPress Playground. Note that this URL is valid for 30 days from when this comment was last updated. You can update it by closing/reopening the PR or pushing a new commit. |
Hi @chihsuan, @rjchow, @woocommerce/ghidorah Apart from reviewing the code changes, please make sure to review the testing instructions as well. You can follow this guide to find out what good testing instructions should look like: |
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.
Thanks, tested well! Confirmed that Cardo and Inter fonts are listed in the option. 👍
…ont-to-global-style
Cardo
and Inter
fonts to global styles via theme json filterCardo
and Inter
fonts to global styles via theme json filter
Changes proposed in this Pull Request:
Closes #47441
Addresses p1715591224614979/1715346843.941069-slack-C01SFMVEYAK
This PR experiments adding
Cardo
andInter
fonts to global styles viawp_theme_json_data_theme
, which originally came from TwentyTwentyFour theme. This allows for WooCommerce plugin to use these fonts without the original theme.This PR is still an experiment due to:
wp_theme_json_data_theme
in WooCommerce, since this piece of code affects the entire site.Also, follow-up work will be needed to set the fonts in coming soon pages.
How to test the changes in this Pull Request:
WooCommerce > Settings > Site visibility
Coming soon
is selected andRestrict to store pages only
is disabledAppearance > Editor > Templates > Page: Coming soon
and editStyles > Typography
Cardo
andInter
fonts are listed in the optionChangelog entry
Significance
Type
Message
Comment