Make WordPress Core

Ticket #17357: 17357.diff

File 17357.diff, 4.5 KB (added by sbressler, 14 years ago)

Patch for help documentation for theme pages

  • wp-admin/includes/plugin.php

     
    10631063 * The function which is hooked in to handle the output of the page must check
    10641064 * that the user has the required capability as well.
    10651065 *
     1066 * This sub menu page is bundled with some help documentation that can be overriden by specific themes.
     1067 *
     1068 * @see add_contextual_help()
     1069 *
    10661070 * @param string $page_title The text to be displayed in the title tags of the page when the menu is selected
    10671071 * @param string $menu_title The text to be used for the menu
    10681072 * @param string $capability The capability required for this menu to be displayed to the user.
     
    10721076 * @return string The resulting page's hook_suffix
    10731077 */
    10741078function add_theme_page( $page_title, $menu_title, $capability, $menu_slug, $function = '' ) {
    1075         return add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
     1079        $theme_page = add_submenu_page( 'themes.php', $page_title, $menu_title, $capability, $menu_slug, $function );
     1080        add_contextual_help( $theme_page,
     1081                '<p>' . __( 'Theme options allow you to customize certain settings available for an individual theme, such as its look and feel.' ) . '</p>' .
     1082                '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
     1083                '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>' ) . '</p>' .
     1084                '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
     1085        );
     1086        return $theme_page;
    10761087}
    10771088
    10781089/**
  • wp-content/themes/twentyeleven/inc/theme-options.php

     
    5555add_action( 'admin_init', 'twentyeleven_theme_options_init' );
    5656
    5757/**
    58  * Add our theme options page to the admin menu.
     58 * Add our theme options page to the admin menu, including some help documentation.
    5959 *
    6060 * This function is attached to the admin_menu action hook.
    6161 *
    6262 * @since Twenty Eleven 1.0
    6363 */
    6464function twentyeleven_theme_options_add_page() {
    65         add_theme_page(
     65        $theme_page = add_theme_page(
    6666                __( 'Theme Options', 'twentyeleven' ), // Name of page
    6767                __( 'Theme Options', 'twentyeleven' ), // Label in menu
    6868                'edit_theme_options',                  // Capability required
    6969                'theme_options',                       // Menu slug, used to uniquely identify the page
    7070                'theme_options_render_page'            // Function that renders the options page
    7171        );
     72        $help = '<p>' . __( 'This Theme Options screen, as enabled by your theme, Twenty Eleven, allows you to change some settings regarding the theme&#8217;s color and layout.') . '</p>' .
     73                        '<p>' . __( 'You can toggle between Light or Dark text areas for your site in Color Scheme, with contrasting letters. Colors could be further changed or examined in the theme&#8217;s CSS via Appearance > Editor. The color for links can be set to specific values or using a color wheel by clicking on the color patch or "Select a Color" button.' ) . '</p>' .
     74                        '<p>' . __( 'There are three options for the theme&#8217;s layout (each containing the same header):' ) . '</p>' .
     75                        '<ol>' .
     76                                '<li>' . __( 'Main content on left, sidebar on right' ) . '</li>' .
     77                                '<li>' . __( 'Main content on right, sidebar on left' ) . '</li>' .
     78                                '<li>' . __( 'Main content spans the entire site&#8217;s width, no sidebar' ) . '</li>' .
     79                        '</ol>' .
     80                        '<p>' . __( 'Remember to click "Save Changes" to save any changes you have made to the theme&#8217;s options.' ) . '</p>' .
     81                        '<p><strong>' . __('For more information:') . '</strong></p>' .
     82                        '<p>' . __( '<a href="http://codex.wordpress.org/Appearance_Theme_Options_Screen" target="_blank">Documentation on Theme Options</a>' ) . '</p>' .
     83                        '<p>' . __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>';
     84
     85        add_contextual_help( $theme_page, $help );
    7286}
    7387add_action( 'admin_menu', 'twentyeleven_theme_options_add_page' );
    7488
     
    113127                ),
    114128                'content' => array(
    115129                        'value' => 'content',
    116                         'label' => __( 'One-column, no Sidebar', 'twentyeleven' ),
     130                        'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
    117131                        'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
    118132                ),
    119133        );