
Untitled
By: a guest on
Aug 17th, 2012 | syntax:
None | size: 1.00 KB | hits: 12 | expires: Never
<?php
function custom_post_dashboard() {
$dashboard_custom_post_types= Array(
//'投稿タイプ名',
'foo',
'bar',
'hoge',
);
foreach($dashboard_custom_post_types as $custom_post_type) {
global $wp_post_types;
$num_post_type = wp_count_posts($custom_post_type);
$num = number_format_i18n($num_post_type->publish);
$text = _n( $wp_post_types[$custom_post_type]->labels->singular_name, $wp_post_types[$custom_post_type]->labels->name, $num_post_type->publish );
$capability = $wp_post_types[$custom_post_type]->cap->edit_posts;
if (current_user_can($capability)) {
$num = "<a href='edit.php?post_type=" . $custom_post_type . "'>$num</a>";
$text = "<a href='edit.php?post_type=" . $custom_post_type . "'>$text</a>";
}
echo '<tr>';
echo '<td class="first b b_' . $custom_post_type . '">' . $num . '</td>';
echo '<td class="t ' . $custom_post_type . '">' . $text . '</td>';
echo '</tr>';
}
}
add_action('right_now_content_table_end', 'custom_post_dashboard');
?>