Test Post
News

Core WP integration
lib/wordpress.ts— Full WP REST API client with graceful fallbacks. Fetches and maps notices, doctors, jobs. Handles pagination headers, cache tags, and the grievance write endpoint. No extra packages needed (uses nativeURLSearchParams).app/api/revalidate/route.ts— Webhook that WordPress calls on publish/edit/delete. Surgically purges the right cache tags per content type.
Config files replaced
lib/config/notices.ts— Now a thin re-export fromlib/wordpress.ts. Same interface, same exports.lib/config/doctors.ts— Same pattern. All pages that imported these still work unchanged.lib/config/jobs.ts— New, same pattern for careers.
Pages updated
/noticesand/notices/[slug]— Now fetch live from WP. Content renders as HTML (WP blocks/formatting preserved).generateStaticParamsuses WP slugs./doctorsand new/doctors/[slug]— Live WP fetch with doctor photo, bio, OPD schedule, NMC number./appointments— Passes live doctor list from WP into the form dropdown.- Appointment API route — Removed hardcoded
DOCTORSlookup; usesdoctorNamedirectly.
New pages
/careers— Job listings with open/closed status, vacancies, deadline./careers/[slug]— Job detail with apply button (external URL or contact form fallback)./feedback— Grievance form. Submissions go to WP (private CPT) AND send an email notification.
Supporting
sitemap.ts— Now async, includes doctor and job pages from WP.nav.ts— Added Careers link.
To test: start the dev server. With WORDPRESS_URL set, all pages will hit the live WP. Since no doctors/jobs are in WP yet, they’ll show empty-state messages gracefully. Add a test doctor in WP Admin → Doctors and it’ll appear immediately.