WordPress.org

Make WordPress Core

Ticket #21129: 21129.diff

File 21129.diff, 1.4 KB (added by kobenland, 6 years ago)

Suggested code snippet, backwards compatible through priority flag

  • wp-content/themes/twentyeleven/inc/theme-options.php

     
    105105}
    106106add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' );
    107107
     108/**
     109 * Add our theme options page to the admin bar.
     110 *
     111 * This function is attached to the admin_bar_menu action hook.
     112 *
     113 * @since Twenty Eleven 1.5
     114 * @param WP_Admin_Bar $wp_admin_bar
     115 * @return void
     116 */
     117function twentyeleven_theme_options_admin_bar_menu( $wp_admin_bar ) {
     118        if ( current_user_can( 'edit_theme_options' ) AND is_admin_bar_showing() ) {
     119                $wp_admin_bar->add_menu( array(
     120                        'title' => __( 'Theme Options', 'twentyeleven' ),
     121                        'href' => add_query_arg( array( 'page' => 'theme_options' ), admin_url( 'themes.php' ) ),
     122                        'parent' => 'appearance',
     123                        'id' => 'twentyeleven-theme-options',
     124                ) );
     125        }
     126}
     127add_action( 'admin_bar_menu', 'twentyeleven_theme_options_admin_bar_menu', 61 ); //Appearance Menu used to be added at 60
     128
    108129function twentyeleven_theme_options_help() {
    109130
    110131        $help = '<p>' . __( 'Some themes provide customization options that are grouped together on a Theme Options screen. If you change themes, options may change or disappear, as they are theme-specific. Your current theme, Twenty Eleven, provides the following Theme Options:', 'twentyeleven' ) . '</p>' .