admin管理员组

文章数量:1288022

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 3 years ago.

Improve this question

My wp-admin bar blocks my mobile menu. How do I prevent that from happening? It forces me to have a top margin that I don't want when users are not signed in. Here's what it looks like when users are not signed in.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 3 years ago.

Improve this question

My wp-admin bar blocks my mobile menu. How do I prevent that from happening? It forces me to have a top margin that I don't want when users are not signed in. Here's what it looks like when users are not signed in.

Share Improve this question asked Sep 7, 2021 at 20:49 Jim F.Jim F. 111 bronze badge 1
  • You can set the top margin to only apply when users are logged in. The WP body tag has class="logged-in admin-bar" when a user is logged in, so you can write your CSS to add the margin only if those classes exist on the body tag: ie. body.logged-in.admin-bar > elementwithmargin{ margin-top:32px; } – Tony Djukic Commented Sep 8, 2021 at 16:10
Add a comment  | 

1 Answer 1

Reset to default 0

You can disable the admin toolbar when viewing the site when a user is logged in. You can do this on a per user basis by going into their profile and unchecking the checkbox for Show toolbar when viewing site or you can do this for all users (including admin users) using the following code:

add_filter( 'show_admin_bar', '__return_false' );

本文标签: wpadmin is blocking my mobile menu icon