Make WordPress Core

Changeset 19580


Ignore:
Timestamp:
12/10/2011 06:31:44 PM (14 years ago)
Author:
ryan
Message:

Contextual help back compat for twentyeleven. Props nacin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/inc/theme-options.php

    r19538 r19580  
    113113
    114114function twentyeleven_theme_options_help() {
    115     if ( ! method_exists( get_current_screen(), 'add_help_tab' ) )
    116         return;
    117 
    118     get_current_screen()->add_help_tab( array(
    119         'title' => __( 'Overview', 'twentyeleven' ),
    120         'id' => 'theme-options-help',
    121         'content' =>
    122             '<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>' .
     115
     116    $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>' .
    123117            '<ol>' .
    124118                '<li>' . __( '<strong>Color Scheme</strong>: You can choose a color palette of "Light" (light background with dark text) or "Dark" (dark background with light text) for your site.', 'twentyeleven' ) . '</li>' .
     
    126120                '<li>' . __( '<strong>Default Layout</strong>: You can choose if you want your site&#8217;s default layout to have a sidebar on the left, the right, or not at all.', 'twentyeleven' ) . '</li>' .
    127121            '</ol>' .
    128             '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>'
    129         )
    130     );
    131 
    132     get_current_screen()->set_help_sidebar(
    133         '<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' .
     122            '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme options.', 'twentyeleven' ) . '</p>';
     123
     124    $sidebar = '<p><strong>' . __( 'For more information:', 'twentyeleven' ) . '</strong></p>' .
    134125        '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>', 'twentyeleven' ) . '</p>' .
    135         '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>'
    136     );
     126        '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>', 'twentyeleven' ) . '</p>';
     127
     128    $screen = get_current_screen();
     129
     130    if ( method_exists( $screen, 'add_help_tab' ) ) {
     131        // WordPress 3.3
     132        $screen->add_help_tab( array(
     133            'title' => __( 'Overview', 'twentyeleven' ),
     134            'id' => 'theme-options-help',
     135            'content' => $help,
     136            )
     137        );
     138
     139        $screen->set_help_sidebar( $sidebar );
     140    } else {
     141        // WordPress 3.2
     142        add_contextual_help( $screen, $help . $sidebar );
     143    }
    137144}
    138145
Note: See TracChangeset for help on using the changeset viewer.