Home » Labs » How to build custom dashboard widgets in WordPress  

How to build custom dashboard widgets in WordPress


Filed under Labs

You can build your own widgets to your WordPress dashboard. Below is a simple code which will demonstrate this, you need to edit this according to your needs.

 
 
<?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' );
?>

Posts you may like: