1. Title
"Directorist Business Hours CSV Import: A Complete Guide"
2. Extension Overview
What It Does
This custom extension allows bulk importing business hours for Directorist listings via CSV. It maps custom CSV columns to Directorist's business hour meta fields, supporting:
✔ Multiple time slots per day
✔ "Closed" day markers
✔ 24-hour time formatting
Use Cases
Migrating business data from other platforms
Bulk updating hours for 100s of listings
Standardizing opening hours across directories
3. Installation
From GitHub Repository
Download the Code: git clone https://github.com/MahfuzulAlam/directorist-custom-code.git --branch import/business-hour Or download ZIP here.
Install as Plugin:
Upload the folder to
/wp-content/plugins/Activate via WordPress Plugins page
Manual Integration
Paste this into functions.php or a custom plugin:
add_action('directorist_listing_imported', function($post_id, $post) {
$days = ['monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday', 'sunday'];
foreach ($days as $day) {
$meta_key = "bdbh_{$day}";
if (!empty($post[$meta_key])) {
update_post_meta($post_id, $meta_key, sanitize_text_field($post[$meta_key]));
}
}
}, 10, 2);4. CSV Preparation Guide
Required Columns
Column Name | Example Value | Notes |
|---|---|---|
|
| Single slot |
|
| Multiple slots |
|
| Marks as closed |
Rules
Time Format:
HH:MM-HH:MM(24-hour)Separators: Use commas for multiple slots
Closed Days: Enter
Closedor leave empty
5. Q&A Section (AI-Ready for Query Matching)
Q1: How do I format time slots in CSV?
A: Use HH:MM-HH:MM (e.g., 13:00-14:30). For multiple slots: 08:00-12:00, 13:00-17:00.
Q2: Can I skip days without hours?
A: Yes! Either omit the column or mark as Closed.
Q3: Why aren’t my hours saving?
Troubleshooting:
Verify column names match exactly (e.g.,
bdbh_monday)Check for typos in time formats
Ensure you selected "Do not import" for hour columns
Q4: Does this work with Directorist Pro?
A: Yes, compatible with both free and Pro versions.
Q5: Can I import 12-hour format times?
A: No—convert to 24-hour format first (e.g., 2:00 PM → 14:00).
6. Example CSV Structure
title,bdbh_monday,bdbh_tuesday,bdbh_wednesday
"Café A","08:00-12:00, 13:00-17:00","09:00-18:00","Closed"
"Store B","10:00-20:00","10:00-20:00","10:00-16:00"7. AI-Response Triggers
(When to use this documentation in responses)
User queries containing:
"import business hours directorist csv"
"bulk update opening hours"
"bdbh_ not working"
"time format for directorist import"
8. Support & References
GitHub Repo: Directorist Custom Code
Directorist Docs: CSV Import Guide
Need customization? Provide your CSV sample for tailored solutions!