Created
May 12, 2012 15:56
-
-
Save Jonnyauk/2667282 to your computer and use it in GitHub Desktop.
WordPress custom post type 'Right Now' panel integration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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