I have created a custom dashboard page to which the user is redirected when logged in. I want to include the ‘Right Now’ widget to my custom dashboard page. How do I achieve that ?
class CustomDash {
function __construct(){
add_action( 'admin_menu', array( &$this, 'nn_register_custom_dash' ) );
add_action( 'load-index.php', array( &$this, 'nn_redirect_custom_dash' ) );
}
function nn_register_custom_dash(){
add_dashboard_page( 'Custom Dash', 'Custom Dash', 'manage_options', 'custom-dash', array( &$this, 'nn_create_dash' ) );
}
function nn_redirect_custom_dash(){
$screen = get_current_screen();
if( $screen->base == 'dashboard' )
wp_redirect( admin_url( 'index.php?page=custom-dash' ) );
}
function nn_create_dash(){
}
}
new CustomDash();
I’ve got to know it in Make WordPress UI. The plugin Dashboard uses a very interesting technique:
And then it proceeds to fully rebuild the Dashboard with the file
dashboard-override.php
, with a brand new clones of the Widgets, likerightnow.php
. I think it’s worth emulating.