mirror of
https://github.com/WordPress/WordPress.git
synced 2024-09-30 08:08:10 +02:00
Keep Dashboard RSS widgets in same place when configuring. props duck_. fixes #14785
git-svn-id: http://svn.automattic.com/wordpress/trunk@16814 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
fdb3b09a99
commit
28f16ea431
@ -138,17 +138,18 @@ function wp_dashboard_setup() {
|
|||||||
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
|
function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null ) {
|
||||||
$screen = get_current_screen();
|
$screen = get_current_screen();
|
||||||
global $wp_dashboard_control_callbacks;
|
global $wp_dashboard_control_callbacks;
|
||||||
|
|
||||||
if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
|
if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
|
||||||
$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
|
$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
|
||||||
if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
|
if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
|
||||||
list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
|
list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
|
||||||
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
|
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
|
||||||
add_meta_box( $widget_id, $widget_name, '_wp_dashboard_control_callback', $screen->id, 'normal', 'core' );
|
$callback = '_wp_dashboard_control_callback';
|
||||||
return;
|
} else {
|
||||||
}
|
|
||||||
list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
|
list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
|
||||||
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
|
$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ( is_blog_admin () )
|
if ( is_blog_admin () )
|
||||||
$side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
|
$side_widgets = array('dashboard_quick_press', 'dashboard_recent_drafts', 'dashboard_primary', 'dashboard_secondary');
|
||||||
|
Loading…
Reference in New Issue
Block a user