Editing Directorist template files inside the plugin folder means updates overwrite your changes. The correct approach places your template overrides in your child theme, where they survive plugin updates. Directorist checks for template overrides in your theme automatically – the same pattern WooCommerce uses.
How Directorist Finds Templates
When Directorist renders any page, its template loader checks for a templates/ directory inside your active child theme. If a file matching the requested template exists there, it uses your version. If not, it falls back to the template inside the plugin. This means you only override the files you need to change – everything else continues to use the plugin’s defaults.
Which Files to Override
Directorist templates are in wp-content/plugins/directorist/templates/. The most commonly customised:
- single-listing.php – the single listing detail page
- listing-card.php – the listing card in archive and search results
- listing-info.php – the information block on single listing pages
- archive-listing.php – the listings archive page layout
Copy only the files you need to change. Unnecessary overrides add maintenance overhead because you need to update them when the plugin changes the original.
Setting Up Your Override
In your child theme, create a templates/ directory. Copy the target file from the plugin to the same relative path in your child theme:
FROM: wp-content/plugins/directorist/templates/listing-card.php
TO: wp-content/themes/your-child-theme/templates/listing-card.php
No configuration needed – Directorist detects the override automatically. To verify it is working, add a visible HTML comment at the top of your file and check the page source.
Need a developer to implement this? Describe your project and get a free estimate.
Useful Functions Inside Templates
Directorist templates use its own helper functions to retrieve listing data:
$listing_id = get_the_ID();
// Get any Directorist custom field value
$phone = directorist_get_listing_meta($listing_id, 'phone');
$website = directorist_get_listing_meta($listing_id, 'website');
$email = directorist_get_listing_meta($listing_id, 'email');
// Get average rating
$rating = directorist_get_average_rating($listing_id);
// Get listing categories
$categories = get_the_terms($listing_id, ATBDP_CATEGORY);
Example: Adding Phone to the Listing Card
The default listing card omits the phone number. To add it, find the correct location inside your listing-card.php override and insert:
$phone = directorist_get_listing_meta(get_the_ID(), 'phone');
if ($phone) {
echo '<div class="directorist-listing-phone">';
echo '<a href="tel:' . esc_attr(preg_replace('/D/', '', $phone)) . '">';
echo esc_html($phone);
echo '</a></div>';
}
Using Action Hooks Instead of Overrides
For adding content to specific positions without replacing entire files, use Directorist action hooks:
// Add a verified badge on single listing pages
add_action('directorist_single_listing_before_content', function() {
if (get_post_meta(get_the_ID(), '_directorist_verified', true)) {
echo '<div class="directorist-verified">Verified Listing</div>';
}
});
// Add a custom CTA after the info section
add_action('directorist_single_listing_after_info', function() {
echo '<div class="listing-cta"><a href="/contact">Request a Quote</a></div>';
});
Overriding the Single Listing Page Layout
The single listing page is where visitor decisions happen. The default layout works adequately but rearranging sections – putting the map above the fold, moving contact information to the top, or adding a booking CTA in a prominent position – can meaningfully affect conversion. Copy single-listing.php to your child theme’s templates/ directory and restructure the layout by moving the PHP function calls that output each section into your preferred order.
To move the contact information block above the description on single listing pages, find where directorist renders these sections and reorder them in your override. Each major section is output by a specific template part call – reorganising these calls changes the visual order without modifying the underlying data or CSS.
Customising the Archive and Search Results Page
The archive page layout (archive-listing.php) controls how listings are presented in grid or list view, how many columns appear, and what information is shown per listing card. For directories where visitors need to compare options quickly – services directories, accommodation directories – the archive layout is as important as the single listing page. Common customisations include adding a comparison mode, showing more listing attributes in the grid cards, or adding a sticky sidebar with category navigation.
CSS Customisation Without Template Overrides
For visual changes that do not require structural HTML changes, target Directorist’s CSS classes in your child theme’s stylesheet. All Directorist classes begin with directorist- which makes them easy to find and target without specificity conflicts:
/* Card styling */
.directorist-listing-card {
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
/* Rating stars colour */
.directorist-star-rating .filled { color: #f59e0b; }
/* Map height on single pages */
.directorist-single-map { height: 350px; }
This approach requires no template override files and survives plugin updates cleanly. Use CSS for visual adjustments and template overrides only when the HTML structure itself needs to change.