prefix . "top_ten_daily"; $is_widget = intval($_GET['widget']); $tptn_settings = tptn_read_options(); $limit = $tptn_settings['limit']; $daily_range = $tptn_settings[daily_range]-1; $current_time = gmdate( 'Y-m-d', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) ); $current_date = strtotime ( '-'.$daily_range. ' DAY' , strtotime ( $current_time ) ); $current_date = date ( 'Y-m-j' , $current_date ); $sql = "SELECT postnumber, SUM(cntaccess) as sumCount, dp_date, ID, post_type, post_status "; $sql .= "FROM $table_name INNER JOIN ". $wpdb->posts ." ON postnumber=ID " ; if ($tptn_settings['exclude_pages']) $sql .= "AND post_type = 'post' "; $sql .= "AND post_status = 'publish' AND dp_date >= '$current_date' "; $sql .= "GROUP BY postnumber "; $sql .= "ORDER BY sumCount DESC LIMIT $limit"; $results = $wpdb->get_results($sql); $output = '
'; echo "document.write('".$output."')"; } tptn_daily_lists(); ?>