public static function check_year_has_posts() { $all_years = self::get_post_year_range(); $years_with_posts = array(); foreach ($all_years as $year) { if (self::date_range_has_posts(self::get_date_stamp($year, 1, 1), self::get_date_stamp($year, 12, 31))) { $years_with_posts[] = $year; } } return $years_with_posts; }
/** * Generate full sitemap for site * * @subcommand generate-sitemap */ function generate_sitemap($args, $assoc_args) { $this->command = 'all'; $all_years_with_posts = Metro_Sitemap::check_year_has_posts(); $sitemap_args = array(); foreach ($all_years_with_posts as $year) { if ($this->halt_execution()) { delete_option('msm_stop_processing'); break; } $sitemap_args['year'] = $year; $this->generate_sitemap_for_year(array(), $sitemap_args); } }