Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress Customizing the WordPress Admin Area Custom Dashboard Widgets in WordPress Custom Dashboard Widgets in WordPress Quiz

Udomsak Duchanee
Udomsak Duchanee
3,110 Points

what function is used in the functions.php file to add a new dashboard widget in wordpress admin area?

what function is used in the functions.php file to add a new dashboard widget in wordpress admin area?

2 Answers

Nasco Lam
Nasco Lam
9,865 Points

Udomsak,

Below you'll find a easy to use method to add a custom dashboard widget. Visit source page

add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets');

function my_custom_dashboard_widgets() {
global $wp_meta_boxes;

wp_add_dashboard_widget('custom_help_widget', 'Theme Support', 'custom_dashboard_help');
}

function custom_dashboard_help() {
echo '<p>Welcome to Custom Blog Theme! Need help? Contact the developer <a href="mailto:yourusername@gmail.com">here</a>. For WordPress Tutorials visit: <a href="http://www.wpbeginner.com" target="_blank">WPBeginner</a></p>';
}