Enforce IDs for add_help_tab(). props mbijon. Restore default_contextual_help, for now. see #18785.
git-svn-id: http://svn.automattic.com/wordpress/trunk@18941 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3804ef7519
commit
35dd66044a
|
@ -189,6 +189,7 @@ if ( 'post' == $post_type ) {
|
|||
}
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'publish-box',
|
||||
'title' => __('Publish Box'),
|
||||
'content' => $publish_box,
|
||||
) );
|
||||
|
@ -197,6 +198,7 @@ if ( 'post' == $post_type ) {
|
|||
$discussion_settings .= '<p>' . __('<strong>Discussion</strong> - You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'discussion-settings',
|
||||
'title' => __('Discussion Settings'),
|
||||
'content' => $discussion_settings,
|
||||
) );
|
||||
|
@ -208,12 +210,25 @@ if ( 'post' == $post_type ) {
|
|||
'<p>' . __('<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
|
||||
);
|
||||
} elseif ( 'page' == $post_type ) {
|
||||
$current_screen->add_help_tab( 'about-pages', __('About Pages'), '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '</p>' .
|
||||
'<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>' );
|
||||
$current_screen->add_help_tab('page-attributes', ('Page Attributes'),
|
||||
'<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
|
||||
$about_pages = '<p>' . __('Pages are similar to Posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest Pages under other Pages by making one the “Parent” of the other, creating a group of Pages.') . '</p>' .
|
||||
'<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the new in 3.2 distraction-free writing space, available in both the Visual and HTML modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box:') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'about-pages',
|
||||
'title' => __('About Pages'),
|
||||
'content' => $about_pages,
|
||||
) );
|
||||
|
||||
$page_attributes = '<p>' . __('<strong>Parent</strong> - You can arrange your pages in hierarchies. For example, you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
|
||||
'<p>' . __('<strong>Template</strong> - Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them in this dropdown menu.') . '</p>' .
|
||||
'<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>' );
|
||||
'<p>' . __('<strong>Order</strong> - Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'page-attributes',
|
||||
'title' => __('Page Attributes'),
|
||||
'content' => $page_attributes,
|
||||
) );
|
||||
|
||||
$current_screen->add_help_sidebar(
|
||||
'<p><strong>' . __('For more information:') . '</strong></p>' .
|
||||
'<p>' . __('<a href="http://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' .
|
||||
|
|
|
@ -590,7 +590,7 @@ final class WP_Screen {
|
|||
*
|
||||
* @param array $args
|
||||
* - string - title - Title for the tab.
|
||||
* - string - id - Tab ID. Optional.
|
||||
* - string - id - Tab ID. Must be HTML-safe.
|
||||
* - string - content - Help tab content in plain text or HTML. Optional.
|
||||
* - callback - callback - A callback to generate the tab content. Optional.
|
||||
*
|
||||
|
@ -604,13 +604,11 @@ final class WP_Screen {
|
|||
);
|
||||
$args = wp_parse_args( $args, $defaults );
|
||||
|
||||
// Ensure we have a title.
|
||||
if ( ! $args['title'] )
|
||||
return;
|
||||
$args['id'] = sanitize_html_class( $args['id'] );
|
||||
|
||||
// Create an id from the title if one is not provided.
|
||||
if ( ! $args['id'] )
|
||||
$args['id'] = sanitize_html_class( $args['title'] );
|
||||
// Ensure we have an ID and title.
|
||||
if ( ! $args['id'] || ! $args['title'] )
|
||||
return;
|
||||
|
||||
$this->_help_tabs[] = $args;
|
||||
}
|
||||
|
@ -642,11 +640,20 @@ final class WP_Screen {
|
|||
$_wp_contextual_help = array();
|
||||
$_wp_contextual_help = apply_filters( 'contextual_help_list', $_wp_contextual_help, $this );
|
||||
|
||||
if ( isset( $_wp_contextual_help[ $this->id ] ) ) {
|
||||
if ( isset( $_wp_contextual_help[ $this->id ] ) || ! $this->_help_tabs ) {
|
||||
// Call old contextual_help filter.
|
||||
if ( isset( $_wp_contextual_help[ $this->id ] ) )
|
||||
$contextual_help = apply_filters( 'contextual_help', $_wp_contextual_help[ $this->id ], $this->id, $this );
|
||||
|
||||
if ( empty( $contextual_help ) ) {
|
||||
$default_help = __( '<a href="http://codex.wordpress.org/" target="_blank">Documentation</a>' );
|
||||
$default_help .= '<br />';
|
||||
$default_help .= __( '<a href="http://wordpress.org/support/" target="_blank">Support Forums</a>' );
|
||||
$contextual_help = '<p>' . apply_filters( 'default_contextual_help', $default_help ) . '</p>';
|
||||
}
|
||||
|
||||
$this->add_help_tab( array(
|
||||
'id' => 'contextual-help',
|
||||
'title' => __('Screen Info'),
|
||||
'content' => $contextual_help,
|
||||
) );
|
||||
|
@ -655,6 +662,7 @@ final class WP_Screen {
|
|||
// Add screen options tab
|
||||
if ( $this->show_screen_options() ) {
|
||||
$this->add_help_tab( array(
|
||||
'id' => 'screen-options',
|
||||
'title' => __('Screen Options'),
|
||||
'callback' => array( $this, 'render_screen_options' ),
|
||||
) );
|
||||
|
|
|
@ -36,6 +36,7 @@ $help_navigation = '<p>' . __('The left-hand navigation menu provides links to
|
|||
$help_navigation .= '<p>' . __('Links in the “admin bar” at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'help-navigation',
|
||||
'title' => __('Navigation'),
|
||||
'content' => $help_navigation,
|
||||
) );
|
||||
|
@ -46,6 +47,7 @@ $help_layout .= '<p>' . __('<strong>Drag and Drop</strong> - To rearrange the bo
|
|||
$help_layout .= '<p>' . __('<strong>Box Controls</strong> - Click the title bar of the box to expand or collapse it. In addition, some box have configurable content, and will show a “Configure” link in the title bar if you hover over it.') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'help-layout',
|
||||
'title' => __('Layout'),
|
||||
'content' => $help_layout,
|
||||
) );
|
||||
|
@ -61,6 +63,7 @@ $help_content .= '<p>' . __('<strong>Other WordPress News</strong> - Shows the <
|
|||
$help_content .= '<p>' . __('<strong>Plugins</strong> - Features the most popular, newest, and recently updated plugins from the WordPress.org Plugin Directory.') . '</p>';
|
||||
|
||||
$current_screen->add_help_tab( array(
|
||||
'id' => 'help-content',
|
||||
'title' => __('Content'),
|
||||
'content' => $help_content,
|
||||
) );
|
||||
|
|
Loading…
Reference in New Issue