Skip to content

Instantly share code, notes, and snippets.

@Jonnyauk
Created May 12, 2012 15:56
Show Gist options
  • Save Jonnyauk/2667282 to your computer and use it in GitHub Desktop.
Save Jonnyauk/2667282 to your computer and use it in GitHub Desktop.
WordPress custom post type 'Right Now' panel integration
<?php
// Add all your custom post type counts to 'Right Now' dashboard widget
function tanc_admin_post_types_rightnow(){
$post_types = get_post_types(array('_builtin' => false), 'objects');
if (count($post_types) > 0)
foreach ($post_types as $pt => $args) {
$url = 'edit.php?post_type=' . $pt;
echo '<tr><td class="b"><a href="' . $url . '">' . wp_count_posts($pt)->publish . '</a></td><td class="t"><a href="' . $url . '">' . $args->labels->name . '</a></td></tr>';
}
}
add_action('right_now_content_table_end', 'tanc_admin_post_types_rightnow');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment