limit_results is set to the value defined by the user in the Options panel // You can include WP SlimStat filters by using the corresponding variables. Please // refer to the source code of wp-slimstat-view.php for more information, or visit our // support forum for help. private function _get_top_custom_pages(){ global $wpdb; $sql = "SELECT resource, COUNT(*) count FROM {$wpdb->prefix}slim_stats WHERE resource <> '' GROUP BY resource ORDER BY count DESC LIMIT 0,$this->limit_results"; return $wpdb->get_results($sql, ARRAY_A); } // end _get_top_pages // Function: show_top_custom_pages // Description: Formats the results obtained through _get_top_pages // Input: none // Output: HTML code public function show_top_custom_pages() { $results = $this->_get_top_custom_pages(); // Boxes come in three sizes: wide, medium, normal (default). // Just add the corresponding class (wide, medium) to the wrapper DIV (see here below) echo '
'; echo '

'.__( 'Title of your custom report', 'wp-slimstat-view' ).'

'; // You need this div here below only if your content is 'taller' than 180px echo '
'; foreach($results as $a_result){ echo "

{$a_result['resource']} {$a_result['count']}

"; } // Don't forget to close your inner div, if you used it :) echo '
'; } // end show_top_pages } // end of class declaration // Ok, let's use the functions defined here above $wp_slimstat_custom = new wp_slimstat_custom_reports(); // Please provide your localization files, if needed load_plugin_textdomain('wp-slimstat-view', WP_PLUGIN_URL .'/wp-slimstat/lang', '/wp-slimstat/lang'); // Use the hook 'wp_dashboard_setup' to attach your reports to the panel // Of course you can attach as many reports as you want :-) add_action('wp_slimstat_custom_report', array( &$wp_slimstat_custom,'show_top_custom_pages')); ?>