Categories
Theme Wordpress

[Easy WP Fix]: Admin’s Top bar covers the portion of the layout’s theme

If the portion of your theme’s layout in WordPress is being covered by the admin’s top bar (if it is turned on in your profile), here’s a quick fix using jQuery.

Please make sure that your jQuery JS is included in your html file.

jQuery(document).ready(function($) {
        if ($('#wpadminbar').length) {
		$('html').css({
			'margin-top': '28px'
		})
		$('header').css({
			'top': '28px'
		})
	}
});

The following part is completely optional. It’s only applicable if you have a header that is position fixed in CSS.

$('header').css({
  'top': '28px'
})

I hope this helps.