[wp-trac] [WordPress Trac] #55985: [Twenty Twelve to Twenty Seventeen]: bundle Google Fonts in each theme

WordPress Trac noreply at wordpress.org
Wed Sep 7 07:22:23 UTC 2022


#55985: [Twenty Twelve to Twenty Seventeen]: bundle Google Fonts in each theme
---------------------------+----------------------
 Reporter:  luminuu        |       Owner:  (none)
     Type:  enhancement    |      Status:  new
 Priority:  high           |   Milestone:  6.1
Component:  Bundled Theme  |     Version:
 Severity:  major          |  Resolution:
 Keywords:  has-patch      |     Focuses:  privacy
---------------------------+----------------------

Comment (by luehrsen):

 Hey @sabernhardt, thank you for taking care of this issue!

 I think I understand the problem (or one of them). Let me try to rephrase
 in my words:

 ''Whenever a child theme dequeues one of the main font stylesheets (e.g.
 `twentyfifteen-fonts`), with my current implementation we ignore that and
 inadvertently dump new font stylesheets into the theme.''

 That is obviously an issue.

 What would you think about declaring the 'new' stylesheets as dependencies
 of the main stylesheet? So of the main stylesheet is dequeued, the subsets
 will not get loaded, all while avoiding duplication.

 So something like:
 {{{#!php

 $dependencies = array();
 foreach ( twentyfifteen_fonts_urls() as $font_slug => $font_url ) {
         wp_register_style( 'twentyfifteen-font-' . $font_slug, $font_url,
 array(), null );
         $dependencies[] = 'twentyfifteen-font-' . $font_slug;
 }

 // Register the style 'twentyfifteen-fonts' for backwards compatibility.
 wp_register_style( 'twentyfifteen-fonts', false, $dependencies );
 wp_enqueue_style( 'twentyfifteen-fonts' );

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/55985#comment:45>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list