I had a great question asked in the support forums today and I thought the answer to it would make for a good how-to post. I was asked how to add the Awaiting Moderation widget found on the Connections Dashboard admin to to the core WordPress Dashboard admin page. This is actually pretty easy, requiring only a few lines of code.
First, you must install the Code Snippets plugin. This plugin is a fantastic tool that can be used to add update safe WordPress actions and filters. When searching how-tos on the web you will very often come across a tutorial that says something like add this to your theme functions.php file. You are far better served by using this plugin instead as it makes managing these code snippets far easier and you are much less likely to break your site.
After you have installed the Code Snippets plugin, add a new snippet with the following code:
function register_cn_awaiting_moderation_dashboard_widget() { $args = array( 'order_by' => 'date_added|SORT_ASC', 'template' => 'dashboard-recent-added', 'limit' => 10, 'status' => 'pending', ); add_meta_box( 'cn-moderate', 'Awaiting Moderation', array( 'cnDashboardMetabox', 'recent' ), 'dashboard', 'normal', 'default', $args ); } add_action( 'wp_dashboard_setup', 'register_cn_awaiting_moderation_dashboard_widget' ); |
Save and activate this new snippet.
That’s it. Now the Awaiting Moderation widget should show on the WordPress Dashboard admin page.