Skip to content
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 margin-top when user is logged in. #1410

Open
StevenDufresne opened this issue Oct 22, 2024 · 0 comments
Open

Add margin-top when user is logged in. #1410

StevenDufresne opened this issue Oct 22, 2024 · 0 comments

Comments

@StevenDufresne
Copy link
Contributor

Describe the bug

We don't include any top margin to account for the admin bar on WordCamp sites and therefore the admin bar overlaps with the header. You can see that at https://asia.wordcamp.org/2025/.

I was thinking we could do something like:

/**
 * Render CSS to adjust the top margin when the admin bar is present for logged-in users.
 */
function wcorg_admin_header_tweak_css() {
	if ( is_user_logged_in() ) {
		$admin_bar_height = 'var(--wp-admin--admin-bar--height, 0)';
		?>
		<style type="text/css">
			html {
				margin-top: <?php echo esc_attr( $admin_bar_height ); ?>;
			}
		</style>
		<?php
	}
}

add_action( 'wp_head', 'wcorg_admin_header_tweak_css' );

Note

It seems like some WordCamp sites have already shipped fixes so whatever we do here, we'll need to reach out to those organizers ahead of time.

@ryelle What are you thoughts about adding this to https://github.com/WordPress/wordcamp.org/blob/production/public_html/wp-content/mu-plugins/3-helpers-misc.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant