会員制サイトを作っていて、特定目的でダッシュボードに入らせるが、アドミンバーだけは非表示にしたい。
これはAdminimizerなどで制御出来るが、トップのマージンが依然として残ったりする。
/* アドミンバー非表示 */ if (!current_user_can('administrator')): show_admin_bar(false); add_action('admin_print_styles', 'admin_css_custom' , 21); function admin_css_custom() { echo '<style>html{padding-top:0!important;}</style>'; } endif;
コメント