Last active
August 29, 2015 13:56
-
-
Save crossreftech/9203889 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Custom Post Type Taxonomies To At A Glance Dashboard Widget | |
function add_post_type_tax_to_right_now() { | |
$args = array( | |
'public' => true , | |
'_builtin' => false | |
); | |
$output = 'object'; | |
$operator = 'and'; | |
$taxonomies = get_taxonomies( $args , $output , $operator ); | |
foreach( $taxonomies as $taxonomy ) { | |
$num_terms = wp_count_terms( $taxonomy->name ); | |
$num = number_format_i18n( $num_terms ); | |
$text = _n( $taxonomy->labels->name, $taxonomy->labels->name , intval( $num_terms )); | |
if ( current_user_can( 'manage_categories' ) ) { | |
$cpt_tax = $taxonomy->name; | |
} | |
echo '<li class="post-count"><tr><a href="edit-tags.php?taxonomy='.$cpt_tax.'"><td class="first b b-' . $taxonomy->name . '"></td>' . $num . ' <td class="t ' . $taxonomy->name . '">' . $text . '</td></a></tr></li>'; | |
} | |
} | |
add_action( 'dashboard_glance_items' , 'add_post_type_tax_to_right_now' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment