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,7 +285,6 @@ 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() {
@ -294,6 +293,18 @@ function wp_admin_bar_header() {
<?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
}
/**
* Determine whether the admin bar should be showing.
*

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' );