Create dashboard widget

Historically, I’ve never been a huge fan of the WordPress Dashboard.  Not because I don’t think it’s a good idea, but mostly because I don’t use it.  Before I turned this into a WordPress / PHP development blog, I posted infrequently and never saw the point of having a dashboard view.  Now that I have traffic, and hope to get more (*crosses fingers*), I’m spending a lot of time there.  Since I’m spending so much time on the dashboard, I thought I might make a bit more useful with a widget.

Adding this PHP code to the functions.php of your wordpress theme will add your custom dashboard widget. This is just the basic building blocks of your own custom dashboard widget.

 

 

<?php
function your_dashboard_widget() {
?>
<h3>Hello WordPress user!</h3>
<p>Fill this with HTML or PHP.</p>
<?php
};
function add_your_dashboard_widget() {
wp_add_dashboard_widget( 'your_dashboard_widget', __( 'Widget Title!' ), 'your_dashboard_widget' );
}
add_action('wp_dashboard_setup', 'add_your_dashboard_widget' );
?>

Leave a comment