I have a website and i need to be able to edit the dashboard widgets so it shows relevant information to the website.
At the moment all that is showing is the right now widget. Inside this widget, i don't need the discussion section nor do i need posts and tags. What i do need is custom post types, for example products and news. So it would say products then how many products there are, like it does with pages.
It would also be great if you could show information from other plugins. For example i'm using a plugin called Support Ticket Center, it would be great if you could show how many open support tickets there are and how many have been closed and things.
Are there any plugins that can do this kind of customization? Or is it more complicated?
Thanks
EDIT: I've tried adding the following code to my functions.php file. It sort of works but the output is adding a lot of other divs and things. I don't understand where they are coming from.
// wp_dashboard_setup is the action hook
add_action('wp_dashboard_setup', 'mycustom_dashboard_stats');
// add dashboard widget
function mycustom_dashboard_stats() {
wp_add_dashboard_widget('site_stat_widget', 'Site Stats','wp_dashboard_custom_post_types');
}
function wp_dashboard_custom_post_types() {
global $wp_registered_sidebars;
$num_posts = wp_count_posts( 'Product' );
echo "\n\t".'<div class="table table_content">';
echo "\n\t".'<p class="sub">' . __('Content') . '</p>'."\n\t".'<table>';
echo "\n\t".'<tr class="first">';
// Posts
$num = number_format_i18n( $num_posts->publish );
$text = _n( 'Product', 'Products', intval($num_posts->publish) );
if ( current_user_can( 'edit_posts' ) ) {
$num = "<a href='edit.php'>$num</a>";
$text = "<a href='edit.php'>$text</a>";
}
echo '<td class="first b b-products">' . $num . '</td>';
echo '<td class="t products">' . $text . '</td>';
echo '</tr>';
}
This is the html code it is outputting.
<div class="table table_content">
<p class="sub">Content</p>
<div class="postbox-container" style="width:49%;">
<div class="postbox-container" style="display:none;width:49%;">
<div class="postbox-container" style="display:none;width:49%;">
<p>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<div class="clear"></div>
<table>
</div>
This will output 'Content' then a huge gap then the number of products. I don't know why it's inserting all of the clear divs and things.
How do i get it to output the html the same as the 'Right Now' widget, so it display properly and would also use the same css.