当前位置: 动力学知识库 > 问答 > 编程问答 >

Hiding wordpress admin bar during development

问题描述:

I created and added this to my footer.php file to try and create something that would 'hide' my admin bar while i was developing because it was getting in the way. Can someone else test this and tell me why it's not working?

<?php global $user_ID; if( $user_ID ) : ?>

<?php if( current_user_can('level_10') ) : ?>

<!-- ?????????????????????????????????????????????????????????????? -->

<div class="hidetheadminbar">ADMIN MENU</div>

<style type="text/css">

.hidetheadminbar {

width: 140px;

height: 48px;

line-height: 48px;

background: #BE0000;

border-radius: 5px 5px 0 0;

box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.7);

position: fixed;

z-index: 999;

left: -80px;

top: 45%;

-webkit-transform: rotate(90deg);

-moz-transform: rotate(90deg);

-o-transform: rotate(90deg);

-ms-transform: rotate(90deg);

transform: rotate(90deg);

-webkit-transition: all 500ms;

-moz-transition: all 500ms;

-ms-transition: all 500ms;

transition: all 500ms;

text-align: center;

color: #FFF;

}

.hidetheadminbar:hover {

left: -50px;

cursor: pointer;

-webkit-transition: all 500ms;

-moz-transition: all 500ms;

-ms-transition: all 500ms;

transition: all 500ms;

}

.gone {

display: none;

}

.zero {

position: relative;

top: -32px;

}

</style>

<script type="text/javascript">

jQuery(document).ready(function() {

jQuery(".hidetheadminbar").click(function() {

jQuery("#wpadminbar").toggleClass("gone");

jQuery("html").toggleClass("zero");

});

jQuery(".hidetheadminbar").trigger("click");

});

</script>

<!-- ????????????????????????????????????????????????????????????? -->

<?php endif; ?>

<?php endif; ?>

网友答案:

Just add a conditional test when u add wp_footer();in your footer.php

分享给朋友:
您可能感兴趣的文章:
随机阅读: