Add bump down for menu bar. Allow themes to add a custom bump callback. Props ocean90. fixes #15592

git-svn-id: http://svn.automattic.com/wordpress/trunk@16636 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2010-11-30 21:50:57 +00:00
parent 44f183e8dd
commit 2911ff8ec3
2 changed files with 23 additions and 2 deletions

View File

@ -285,12 +285,23 @@ function wp_admin_bar_updates_menu() {
* Style and scripts for the admin bar.
*
* @since 3.1.0
* @todo move js into a admin-bar js file
*
*/
function wp_admin_bar_header() {
?>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<style type="text/css" media="print">#wpadminbar { display:none; }</style>
<?php
}
/**
* Default admin bar callback.
*
* @since 3.1.0
*
*/
function _admin_bar_bump_cb() {
?>
<style type="text/css">body { padding-top: 28px !important; }</style>
<?php
}

View File

@ -36,6 +36,16 @@ class WP_Admin_Bar {
add_action( 'admin_head', 'wp_admin_bar_header' );
if ( current_theme_supports( 'admin-bar' ) ) {
$admin_bar_args = get_theme_support( 'admin-bar' ); // add_theme_support( 'admin-bar', array( 'callback' => '__return_false') );
$header_callback = $admin_bar_args[0]['callback'];
}
if ( empty($header_callback) )
$header_callback = '_admin_bar_bump_cb';
add_action('wp_head', $header_callback);
wp_enqueue_script( 'admin-bar' );
wp_enqueue_style( 'admin-bar' );