WordPress create custom dashboard widget

WordPress custom dashboard widget

//----- Dashboard widget -----
// function for creating widget view
// Function that outputs the contents of the dashboard widget. 
// The function should echo its output.
function simple_dashboard_widget_function() {
    // Display whatever you want to show
    echo '<iframe src="http://www.workassis.com" width="100%" height="300" frameBorder="0">Browser not compatible.</iframe>';
}

// Create the function use in the action hook
function add_dashboard_widgets() {
    
    wp_add_dashboard_widget('simple_dashboard_widget', 'Simple Dashboard Widget', 'simple_dashboard_widget_function');
}

// Register the new dashboard widget with the 'wp_dashboard_setup' action
add_action('wp_dashboard_setup', 'add_dashboard_widgets' );

//-------End of Dashboard widget--------

dashboard widget

 

Related topics

ref: https://codex.wordpress.org/Function_Reference/wp_add_dashboard_widget

Author: bm on June 22, 2016
Category: wordpress
Tags: , , ,