From adbb5626ff3840852663f8406baba68703a61b6a Mon Sep 17 00:00:00 2001 From: Steven Dufresne Date: Wed, 13 Nov 2024 13:14:17 +0900 Subject: [PATCH] Remove header bump. (#665) --- mu-plugins/blocks/global-header-footer/blocks.php | 11 ----------- .../blocks/global-header-footer/postcss/_common.pcss | 3 --- 2 files changed, 14 deletions(-) diff --git a/mu-plugins/blocks/global-header-footer/blocks.php b/mu-plugins/blocks/global-header-footer/blocks.php index e884bbef..02a2faa9 100644 --- a/mu-plugins/blocks/global-header-footer/blocks.php +++ b/mu-plugins/blocks/global-header-footer/blocks.php @@ -9,7 +9,6 @@ require_once __DIR__ . '/admin-bar.php'; add_action( 'init', __NAMESPACE__ . '\register_block_types' ); -add_action( 'admin_bar_init', __NAMESPACE__ . '\remove_admin_bar_callback', 15 ); add_action( 'rest_api_init', __NAMESPACE__ . '\register_routes' ); add_filter( 'wp_enqueue_scripts', __NAMESPACE__ . '\register_block_assets', 200 ); // Always last. add_action( 'wp_enqueue_scripts', __NAMESPACE__ . '\enqueue_compat_wp4_styles', 5 ); // Before any theme CSS. @@ -83,16 +82,6 @@ function register_block_assets() { ); } -/** - * Remove the default margin-top added when the admin bar is used. - * - * The core handling uses `!important`, which overrides the sticky header offset in `common.pcss`. - */ -function remove_admin_bar_callback() { - remove_action( 'gp_head', '_admin_bar_bump_cb' ); - remove_action( 'wp_head', '_admin_bar_bump_cb' ); -} - /** * Register REST API routes, so non-WP applications can integrate it. */ diff --git a/mu-plugins/blocks/global-header-footer/postcss/_common.pcss b/mu-plugins/blocks/global-header-footer/postcss/_common.pcss index c30ac861..701d8884 100644 --- a/mu-plugins/blocks/global-header-footer/postcss/_common.pcss +++ b/mu-plugins/blocks/global-header-footer/postcss/_common.pcss @@ -21,9 +21,6 @@ html { --wp--custom--alignment--scroll-bar-width: 8px; - /* Offset from the top of the page which is covered by "stuck" items (admin bar & header). */ - --wp-global-header-offset: calc(var(--wp-global-header-height, 0px) + var(--wp-admin--admin-bar--height, 0px)); - margin-top: var(--wp-admin--admin-bar--height, 0); height: unset; /* Let height use default browser height. */ }