Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.44 KB | None | 0 0
  1. <php
  2. /**
  3. * Register widget area
  4. *
  5. */
  6. function fp_dashboard_widgets_init() {
  7.  
  8. register_sidebar( array(
  9. 'name' => __('Extra Dashboard Widgets'),
  10. 'id' => 'fp_extra_dashboard_widgets',
  11. 'before_widget' => '<div>',
  12. 'after_widget' => '</div>',
  13. 'before_title' => '<h2 class="rounded">',
  14. 'after_title' => '</h2>',
  15. ) );
  16.  
  17. }
  18. add_action( 'widgets_init', 'fp_dashboard_widgets_init' );
  19.  
  20. /**
  21. * Add widget area to the dashboard.
  22. *
  23. * This function is hooked into the 'wp_dashboard_setup' action below.
  24. */
  25. function fp_extra_dashboard_widgets_add_dashboard_widgets() {
  26.  
  27. wp_add_dashboard_widget(
  28. 'fp_extra_dashboard_widgets', // Widget slug.
  29. __('Extra Dashboard Widgets'), // Title.
  30. 'fp_output_extra_dashboard_widgets' // Display function.
  31. );
  32. }
  33. add_action( 'wp_dashboard_setup', 'fp_extra_dashboard_widgets_add_dashboard_widgets' );
  34.  
  35. /**
  36. * Create the function to output the contents of the extra Dashboard widget.
  37. */
  38. function fp_output_extra_dashboard_widgets() {
  39.  
  40. // Display whatever it is you want to show.
  41. if ( is_active_sidebar( 'fp_extra_dashboard_widgets' ) ) : ?>
  42. <ul id="fp-dashboard-widgets">
  43. <?php dynamic_sidebar( 'fp_extra_dashboard_widgets' ); ?>
  44. </ul>
  45. <?php endif;
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement