Revise admin bar items based on user testing. Post at http://wp.me/pbNCB-qz. see #18197.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
bc3fc076e1
commit
dcf34868ed
|
@ -21,10 +21,6 @@ if ( !defined('ABSPATH') )
|
|||
$upgrade = apply_filters( 'update_footer', '' );
|
||||
$footer_text = array(
|
||||
'<span id="footer-thankyou">' . __( 'Thank you for creating with <a href="http://wordpress.org/">WordPress</a>.' ) . '</span>',
|
||||
__( '<a href="http://codex.wordpress.org/">Documentation</a>' ),
|
||||
sprintf( '<a href="%s">' . __( 'Freedoms' ) . '</a>', admin_url( 'freedoms.php' ) ),
|
||||
__('<a href="http://wordpress.org/support/forum/requests-and-feedback">Feedback</a>'),
|
||||
sprintf( '<a href="%s">' . __('Credits') . '</a>', admin_url('credits.php') ),
|
||||
);
|
||||
echo apply_filters( 'admin_footer_text', implode( ' • ', $footer_text ) );
|
||||
unset( $footer_text );
|
||||
|
|
|
@ -91,17 +91,51 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
|||
) );
|
||||
}
|
||||
|
||||
// Add codex link
|
||||
// Add freedoms link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo',
|
||||
'id' => 'freedoms',
|
||||
'title' => __('Freedoms'),
|
||||
'href' => admin_url('freedoms.php'),
|
||||
) );
|
||||
|
||||
// Add credits link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo',
|
||||
'id' => 'credits',
|
||||
'title' => __('Credits'),
|
||||
'href' => admin_url('credits.php'),
|
||||
) );
|
||||
|
||||
// Add secondary menu.
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo',
|
||||
'id' => 'wp-logo-secondary',
|
||||
'title' => __( ' ' ),
|
||||
'meta' => array(
|
||||
'class' => 'secondary',
|
||||
),
|
||||
) );
|
||||
|
||||
// Add codex link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo-secondary',
|
||||
'id' => 'documentation',
|
||||
'title' => __('Documentation'),
|
||||
'href' => 'http://codex.wordpress.org',
|
||||
) );
|
||||
|
||||
// Add feedback link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo-secondary',
|
||||
'id' => 'feedback',
|
||||
'title' => __('Feedback'),
|
||||
'href' => 'http://wordpress.org/support/forum/requests-and-feedback',
|
||||
) );
|
||||
|
||||
// Add forums link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo',
|
||||
'parent' => 'wp-logo-secondary',
|
||||
'id' => 'support-forums',
|
||||
'title' => __('Support Forums'),
|
||||
'href' => 'http://wordpress.org/support/',
|
||||
|
@ -109,7 +143,7 @@ function wp_admin_bar_wp_menu( $wp_admin_bar ) {
|
|||
|
||||
// Add WordPress.org link
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'wp-logo',
|
||||
'parent' => 'wp-logo-secondary',
|
||||
'id' => 'wporg',
|
||||
'title' => __('WordPress.org'),
|
||||
'href' => 'http://wordpress.org',
|
||||
|
@ -181,35 +215,6 @@ function wp_admin_bar_my_account_menu( $wp_admin_bar ) {
|
|||
'class' => 'user-info-item',
|
||||
),
|
||||
) );
|
||||
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'my-account',
|
||||
'id' => 'my-account-secondary',
|
||||
'title' => ' ',
|
||||
'meta' => array(
|
||||
'class' => 'secondary',
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
wp_admin_bar_my_sites_menu( $wp_admin_bar );
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the "Network Admin" menu.
|
||||
*
|
||||
* @since 3.3.0
|
||||
*/
|
||||
function wp_admin_bar_network_admin_menu( $wp_admin_bar ) {
|
||||
if ( is_multisite() && is_super_admin() && ! is_network_admin() ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'id' => 'network-admin',
|
||||
'title' => __('Network Admin'),
|
||||
'href' => network_admin_url(),
|
||||
'meta' => array(
|
||||
'class' => 'opposite',
|
||||
),
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -279,6 +284,13 @@ function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
|
|||
'title' => $title_excerpt,
|
||||
'href' => $url,
|
||||
) );
|
||||
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'blog-name',
|
||||
'id' => 'view-site',
|
||||
'title' => __( 'Visit Site' ),
|
||||
'href' => home_url(),
|
||||
) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,7 +301,40 @@ function wp_admin_bar_blog_admin_menu( $wp_admin_bar ) {
|
|||
function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
||||
global $wpdb;
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
// Don't show for logged out users or single site mode.
|
||||
if ( ! is_user_logged_in() || ! is_multisite() )
|
||||
return;
|
||||
|
||||
// Show only when there are more than two items in the menu.
|
||||
if ( count( $wp_admin_bar->user->blogs ) <= 1 && ! is_super_admin() )
|
||||
return;
|
||||
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'id' => 'my-sites',
|
||||
'title' => __( 'My Sites' ),
|
||||
'href' => admin_url( 'my-sites.php' ),
|
||||
) );
|
||||
|
||||
if ( is_super_admin() ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'my-sites',
|
||||
'id' => 'network-admin',
|
||||
'title' => __('Network Admin'),
|
||||
'href' => network_admin_url(),
|
||||
) );
|
||||
}
|
||||
|
||||
if ( $wp_admin_bar->user->blogs ) {
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'my-sites',
|
||||
'id' => 'my-sites-secondary',
|
||||
'title' => ' ',
|
||||
'meta' => array(
|
||||
'class' => 'secondary',
|
||||
),
|
||||
) );
|
||||
}
|
||||
|
||||
// Add blog links
|
||||
$blue_wp_logo_url = includes_url('images/wpmini-blue.png');
|
||||
|
||||
|
@ -307,7 +352,7 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
|||
$menu_id = 'blog-' . $blog->userblog_id;
|
||||
|
||||
$wp_admin_bar->add_menu( array(
|
||||
'parent' => 'my-account-secondary',
|
||||
'parent' => 'my-sites-secondary',
|
||||
'id' => $menu_id,
|
||||
'title' => $blavatar . $blogname,
|
||||
'href' => get_admin_url( $blog->userblog_id ),
|
||||
|
@ -343,7 +388,6 @@ function wp_admin_bar_my_sites_menu( $wp_admin_bar ) {
|
|||
) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Provide a shortlink.
|
||||
|
|
|
@ -175,12 +175,12 @@ class WP_Admin_Bar {
|
|||
function add_menus() {
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_wp_menu', 10 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_my_account_menu', 10 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_edit_menu', 30 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_new_content_menu', 40 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 50 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 70 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_shortlink_menu', 80 );
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_network_admin_menu', 80 );
|
||||
|
||||
if ( ! is_admin() ) {
|
||||
add_action( 'admin_bar_menu', 'wp_admin_bar_blog_front_menu', 25 );
|
||||
|
|
Loading…
Reference in New Issue