// Add custom CSS for modern dark UI add_action('admin_head', function() { echo ''; }); // Helper: Seed months table for current and next year public static function seed_months_if_needed() { global $wpdb; $months_table = $wpdb->prefix . 'pf_months'; $settings_table = $wpdb->prefix . 'pf_settings'; $settings = $wpdb->get_row("SELECT * FROM $settings_table WHERE id=1", ARRAY_A); $now = new DateTime(); $y = (int)$now->format('Y'); $targetEndYear = isset($settings['seeded_until_year']) ? max((int)$settings['seeded_until_year'], $y+1) : $y+1; $start = DateTime::createFromFormat('Y-m', $now->format('Y-m')); $end = DateTime::createFromFormat('Y-m', sprintf('%04d-12',$targetEndYear)); $cursor = clone $start; while ($cursor <= $end) { $month = $cursor->format('Y-m'); $wpdb->query($wpdb->prepare("INSERT IGNORE INTO $months_table (month) VALUES (%s)", $month)); $cursor->modify('first day of next month'); } } BudgetTracker

Blog