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

git-svn-id: https://develop.svn.wordpress.org/trunk@16636 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2010-11-30 21:50:57 +00:00
parent 508084aba6
commit f03bfe223f
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' );