Skip to content

Commit

Permalink
Make 2024: Fix style enqueuing order
Browse files Browse the repository at this point in the history
See #363


git-svn-id: https://meta.svn.wordpress.org/sites/trunk@14031 74240141-8908-4e6f-9713-ba540dce6ec7
  • Loading branch information
Adam Wood committed Sep 9, 2024
1 parent 0f9be02 commit e2c1d93
Showing 1 changed file with 8 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,27 +31,29 @@ function after_setup_theme() {
add_action( 'after_setup_theme', __NAMESPACE__ . '\after_setup_theme', 11 );

/**
* Enqueue scripts and styles.
*
* Enqueue existing wordpress.org/support stylesheets
* @link https://meta.trac.wordpress.org/browser/sites/trunk/wordpress.org/public_html/style
* Enqueue styles.
*/
function wporg_breathe_scripts() {
function wporg_breathe_styles() {
wp_dequeue_style( 'wp4-styles' );
wp_dequeue_style( 'breathe-style' );
wp_enqueue_style( 'p2-breathe', get_template_directory_uri() . '/style.css' );

wp_enqueue_style(
'wporg-parent-2021-style',
get_theme_root_uri() . '/wporg-parent-2021/build/style.css',
[ 'wporg-global-fonts' ],
filemtime( get_theme_root() . '/wporg-parent-2021/build/style.css' )
);

wp_enqueue_style(
'wporg-parent-2021-block-styles',
get_theme_root_uri() . '/wporg-parent-2021/build/block-styles.css',
[ 'wporg-global-fonts' ],
filemtime( get_theme_root() . '/wporg-parent-2021/build/block-styles.css' )
);

wp_enqueue_style( 'wporg-breathe', get_stylesheet_uri(), array( 'p2-breathe' ), filemtime( __DIR__ . '/style.css' ) );

// Preload the heading font(s).
if ( is_callable( 'global_fonts_preload' ) ) {
/* translators: Subsets can be any of cyrillic, cyrillic-ext, greek, greek-ext, vietnamese, latin, latin-ext. */
Expand All @@ -60,7 +62,7 @@ function wporg_breathe_scripts() {
global_fonts_preload( 'Inter', $subsets );
}
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\wporg_breathe_scripts' );
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\wporg_breathe_styles', 11 );

/**
* Merge the support theme's theme.json into the parent theme.json.
Expand Down Expand Up @@ -269,14 +271,6 @@ function customize_partial_blogname() {
bloginfo( 'name' );
}

function styles() {
wp_dequeue_style( 'breathe-style' );
wp_enqueue_style( 'p2-breathe', get_template_directory_uri() . '/style.css' );

wp_enqueue_style( 'wporg-breathe', get_stylesheet_uri(), array( 'p2-breathe' ), filemtime( __DIR__ . '/style.css' ) );
}
add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\styles', 11 );

function scripts() {
wp_enqueue_script( 'wporg-breathe-chapters', get_stylesheet_directory_uri() . '/js/chapters.js', array( 'jquery' ), '20200127' );
}
Expand Down

0 comments on commit e2c1d93

Please sign in to comment.