

To get it done we will use the following HTML structure: We’ll be building the example above with CSS only, no Javascript required. The end result of our efforts HTML Structure This will be a simplified example, a proof of concept if you will. Let’s create a widget that shows the number of comments our website has received each week for the past five weeks. The main way you can enhance dashboard widgets is by creating some nice styles or applying some Javascript functionality. The last step is to replace the original dashboard array with our new sorted one. The array_merge() function appends the second array to the first so our widget will now be the first one in the new $sorted_dashboard array. The next step is to merge the contents of $my_widget and $dashboard. This is stored in the $my_widget variable because we need to unset it in the next line and then re-add it. The next step is to grab our registered widget from the array of widgets. To make things easier on the eyes I’ve separated out the widgets which are displayed on the dashboard into the $dashboard variable. The first step is to globalize the $wp_meta_boxes variable which contains information about all registered widgets. Seven additional lines for a simple rearranging is a bit much but since no other method is available, this will have to do.
