How to Create a Custom Dashboard Widget WordPress

Written by on August 31, 2012 in WordPress - No comments
wordpress-dashboard-widget

Here’s an easy way to add a custom dashboard widget to your WordPress theme. This is a great way to add helper text for a custom theme to explain custom features of the theme, help your clients understand the theme, etc. Add the following to your functions.php file and edit the text below.

// Create the function to output the contents of our Dashboard Widget

function example_dashboard_widget_function() {
	// Display whatever it is you want to show
	echo "enter text for custom dashboard widget here";
} 

// Create the function use in the action hook

function example_add_dashboard_widgets() {
	wp_add_dashboard_widget('example_dashboard_widget', 'Site Details', 'example_dashboard_widget_function');	
} 

// Hook into the 'wp_dashboard_setup' action to register our other functions

add_action('wp_dashboard_setup', 'example_add_dashboard_widgets' ); 

source

Sponsors

About the Author

Mike Ilsley "ilz" is a Boston based website designer, front-end developer, WordPress addict, owner of Beantown Design, and exclusive ThemeForest author. Follow him on Twitter and Facebook, and don't forget to subscribe to the WebDesign&Such email RSS feed. Also, check out his latest project, jQueryMobileShowcase.com.