', $after='') { global $wpdb, $PHP_SELF; setlocale(LC_ALL,WPLANG); $now = gmdate("Y-m-d H:i:s",(time()+((get_settings('gmt_offset'))*3600))); if (($format == 'yearly') || ($format == '')) { $modus = ""; } else if($format == 'yearly_act') { $modus = " AND year(post_date) = ".date('Y'); } else if($format == 'yearly_past') { $modus = " AND year(post_date) < ".date('Y'); } else if(preg_match("/^[0-9]{4}$/", $format)) { $modus = " AND year(post_date) = '".$format."'"; } $jahreMitBeitrag = $wpdb->get_results("SELECT DISTINCT post_date, year(post_date) AS `year`, COUNT(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'".$modus." GROUP BY year(post_date) ORDER BY post_date DESC"); /*if(preg_match("/^[0-9]{4}$/", $format)) { echo "True"; } else { echo "False"; }*/ //printf("SELECT DISTINCT post_date, year(post_date) AS `year`, COUNT(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'".$modus." GROUP BY year(post_date) ORDER BY post_date DESC"); foreach ($jahreMitBeitrag as $aktuellesJahr) { for ($aktuellerMonat = 1; $aktuellerMonat <= 12; $aktuellerMonat++) { $monateMitBeitrag[$aktuellesJahr->year][$aktuellerMonat] = $wpdb->get_results("SELECT ID, post_date, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND year(post_date) = '$aktuellesJahr->year' ORDER BY post_date desc"); } } if (($format == 'yearly') || ($format == 'yearly_act') || ($format == 'yearly_past') || ($format == '') || (preg_match("/^[0-9]{4}$/", $format))) { ($before == '') ? $before = '