diff --git a/src/Deprecated/Deprecated.php b/src/Deprecated/Deprecated.php
index 9809c1b..b394212 100644
--- a/src/Deprecated/Deprecated.php
+++ b/src/Deprecated/Deprecated.php
@@ -245,31 +245,62 @@ public static function business_profile_render_services() {
public static function business_profile_data_hours_of_operation() {
$json_data = get_option('bpr_business_profile');
- $hours = $json_data['hours_of_operation'];
- $hours_of_operation = "
";
- foreach ($hours as $hour) {
- $hours_of_operation .= "- $hour
";
- }
- $hours_of_operation .= "
";
+ $hours = $json_data['hours_of_operation'] ?? [];
+
+ // Check if hours of operation exist
if (empty($hours)) {
- return "- Missing Hours of Operation
";
+ return "
+ - Missing Hours of Operation
+
";
}
- return $hours_of_operation;
- }
-
- public static function business_profile_render_hours_of_operation() {
- $json_data = get_option('bpr_business_profile');
- $hours = $json_data['hours_of_operation'];
- $hours_of_operation = "";
+
+ // Start building the hours of operation list
+ $hours_of_operation = "";
+
foreach ($hours as $hour) {
- $hours_of_operation .= "- $hour
";
+ // Assuming each $hour is already a plain string like "Monday: 9:00 AM – 5:00 PM"
+ $hours_of_operation .= "-
+ $hour
+
";
}
+
+ // Close the list and return
$hours_of_operation .= "
";
- if (empty($hours)) {
- return "- Missing Hours of Operation
";
- }
+
return $hours_of_operation;
}
+
+
+ public static function business_profile_render_hours_of_operation() {
+ $json_data = get_option('bpr_business_profile');
+ $hours = $json_data['hours_of_operation'];
+
+ // Check if hours of operation exist
+ if (empty($hours)) {
+ return "
+ - Missing Hours of Operation
+
";
+ }
+
+ // Start building the hours of operation list
+ $hours_of_operation = "";
+
+ foreach ($hours as $hour) {
+ $day_of_week = isset($hour['day_of_week'][0]) ? $hour['day_of_week'][0] : 'Unknown Day';
+ $opens = isset($hour['opens']) ? date("g:i A", strtotime($hour['opens'])) : 'Closed';
+ $closes = isset($hour['closes']) ? date("g:i A", strtotime($hour['closes'])) : 'Closed';
+
+ // Format each day's operation hours
+ $hours_of_operation .= "-
+ $day_of_week: $opens - $closes
+
";
+ }
+
+ // Close the list and return
+ $hours_of_operation .= "
";
+
+ return $hours_of_operation;
+ }
/**
* Exit the shortcodes for Hours of Operation