Adding widgets to wordpress admin dashboard


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. add_action('wp_dashboard_setup', 'custom_dashboard_widgets');
  2.  
  3. function custom_dashboard_widgets(){
  4. //first parameter is the ID of the widget (the div holding the widget will have that ID)
  5. //second parameter is title (shown in the header of the widget) -> see picture bellow
  6. //third parameter is the function name we are calling to get the content of our widget
  7. wp_add_dashboard_widget('my_custom_widget_id', 'My Widget Title', 'my_custom_widget');
  8. }
  9.  
  10. function my_custom_widget() {
  11. //the content of our custom widget
  12. echo '<p>The content of the widget goes here.</p>';
  13. }

URL: http://wpcanyon.com/tipsandtricks/adding-widgets-to-wordpress-admin-dashboard/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.