// Get department contacts for this contact page // Only show departments if this is the specific campus page (not a fallback) $department_contacts = []; if (!empty($page_data['id'])) { try { // Check if this contact page matches the requested campus slug $page_campus_slug = $page_data['campus_slug'] ?? ''; $is_specific_campus_page = ($campus_slug === 'contact' && empty($page_campus_slug)) || (!empty($page_campus_slug) && $page_campus_slug === $campus_slug); if ($is_specific_campus_page) { $stmt = $conn->prepare("SELECT * FROM department_contacts WHERE contact_page_id = ? AND is_active = 1 ORDER BY display_order, department_name"); $stmt->execute([$page_data['id']]); $department_contacts = $stmt->fetchAll(PDO::FETCH_ASSOC); } } catch (PDOException $e) { // Silently log the error but don't break the page error_log("Error loading department contacts: " . $e->getMessage()); } }