The code

Add the snippet bellow to your theme’s functions.php file.

add_action('wp_dashboard_setup', 'custom_dashboard_widgets');

function custom_dashboard_widgets(){
	//first parameter is the ID of the widget (the div holding the widget will have that ID)
	//second parameter is title (shown in the header of the widget) -> see picture bellow
	//third parameter is the function name we are calling to get the content of our widget
	wp_add_dashboard_widget('my_custom_widget_id', 'My Widget Title', 'my_custom_widget');
}

function my_custom_widget() {
	//the content of our custom widget
	echo '<p>The content of the widget goes here.</p>';
}

The outcome

What about multiple widgets?

add_action('wp_dashboard_setup', 'custom_dashboard_widgets');

function custom_dashboard_widgets(){
	wp_add_dashboard_widget('my_custom_widget_id', 'My Widget Title', 'my_custom_widget');
	wp_add_dashboard_widget('my_custom_widget_id_second', 'My Second Widget Title', 'my_second_custom_widget');
}

function my_custom_widget() {
	echo '<p>The content of the widget goes here.</p>';
}

function my_second_custom_widget() {
	echo '<p>The content of the second widget goes here.</p>';
}

Learn about wordpress plugins with 70-647 dumps. We offer complete collection of 70-290 dumps as well as 642-436 dumps to help you become master of whole technology.