function custom_dashboard_help() { hello_nano(); $allpostargs = array('post_status' => array('publish'), 'post_type' => 'entry', 'posts_per_page' => -1); $allposts = get_posts($allpostargs); $totalwordcount = get_total_wordcount($allposts); echo '<h2>Total Word Count: ' . $totalwordcount . '</h2>'; echo '<p>todo: instructions and possibly RSS feed here</p>'; }
public function widget($args, $instance) { $this->nano_widget_menu(); echo $args['before_widget']; if (!empty($instance['title'])) { echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title']; } else { echo $args['before_title'] . apply_filters('widget_title', 'My NaNo Stats') . $args['after_title']; } $allpostargs = array('post_status' => array('publish'), 'post_type' => 'entry', 'posts_per_page' => -1); $allposts = get_posts($allpostargs); $totalwordcount = get_total_wordcount($allposts); echo '<h2>Total Wordcount: </h2>'; echo $totalwordcount; echo '<h2>Remaining Wordcount: </h2>'; $math = 50000 - $totalwordcount; echo $math; echo $args['after_widget']; }