You can use Custom Post Type in WordPress 3.0. By default, Number of Custom Post Type is now shown in “Right Now” on your Dashboard. You can see how many Custom Post Type you posted, by adding the following code on your functions.php.
Please fill in the label of the custom post type. For example, you are using an “event” post type, $custom_post_type = 'event';
.
function custom_post_dashboard() { $custom_post_type = 'event'; // Fill in the label of CPT 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');
Here, right_now_content_table_end
is a name of action hook.
The picture is a dashboard with an additional row “イベント” (Japanese word for “event”). If users are allowed to edit the posts of this custom post type, they can click the link and go to edit.php.