Override any template from your theme, customize colors with CSS custom properties, and extend styles using the BEM naming convention.
Local Directory uses a template resolution system that lets you override any template file from your WordPress theme without modifying the plugin itself.
A child theme is a small theme that inherits everything from your main theme (the "parent") but lets you make changes that won't be lost when the parent theme updates. It only needs two files: a style.css with a Template: parent-folder-name header, and a functions.php that loads the parent's styles. Most themes (including Kadence, Astra, and GeneratePress) offer a one-click child theme generator. See the Build Your Site guide for step-by-step instructions on creating one.
When a template is loaded, the plugin checks three locations in order, using the first match it finds:
wp-content/themes/{child-theme}/local-directory/{template}.php
wp-content/themes/{parent-theme}/local-directory/{template}.php
local-directory/templates/{template}.php
To override a template, create a local-directory folder in your child theme and copy the template file you want to customize. Maintain the same relative path for partials and email templates.
your-child-theme/
local-directory/
listing-card.php # Override the listing card
listing-single.php # Override the single listing page
search-form.php # Override the search form
partials/
rating-stars.php # Override the rating stars partial
badges.php # Override the badges partial
emails/
listing-approved.php # Override the approval email
If you need to change the directory name or resolution logic entirely, use the ld_template_path filter:
// Change the theme override folder name
add_filter( 'ld_template_path', function( $path, $template ) {
// Look in "my-directory/" instead of "local-directory/"
$custom = get_stylesheet_directory() . '/my-directory/' . $template;
if ( file_exists( $custom ) ) {
return $custom;
}
return $path;
}, 10, 2 );
Tip: Always override templates in a child theme, never in the parent theme directly. This ensures your changes survive theme updates.
All template files that can be overridden are listed below, organized by type. Each template receives contextual variables relevant to its purpose.
| Template | Description |
|---|---|
directory.php |
Main directory page — the top-level layout wrapper for the directory view |
listings.php |
Listing grid/list container — renders the grid or list of listing cards |
listing-card.php |
Single listing card — used in grid and list views, search results, and maps |
listing-single.php |
Full single listing page — the complete detail view for one listing |
search-form.php |
Search form — keyword, category, location, and filter controls |
categories-grid.php |
Category grid — displays all categories with icons and listing counts |
taxonomy-archive.php |
Taxonomy archive — archive pages for category and location terms |
map.php |
Map container — wrapper for the Leaflet or Google Maps instance |
compare.php |
Comparison table — side-by-side comparison of up to 4 listings |
recently-viewed.php |
Recently viewed listings — shows the visitor's browsing history |
claim-form.php |
Multi-step claim form — business owner verification and claim request |
report-form.php |
Report form — allows visitors to flag inaccurate listing information |
no-comments.php |
Prevents duplicate comment forms — blank template for listings without reviews |
Reusable template fragments included by main templates. Override path: partials/{filename}.php
| Template | Description |
|---|---|
partials/rating-stars.php |
Star rating display with aggregate score |
partials/rating-criteria.php |
Per-criteria rating breakdown (e.g., Food, Service, Ambiance) |
partials/photo-gallery.php |
Listing photo gallery with lightbox |
partials/badges.php |
Verified, featured, and price-level badges |
partials/favorite-button.php |
Heart icon toggle for favorites |
partials/compare-button.php |
Add-to-compare toggle button |
partials/business-attributes.php |
Business details like phone, website, and address |
partials/opening-hours.php |
Weekly opening hours table with "Open now" indicator |
partials/analytics-sparkline.php |
Mini sparkline chart for listing view statistics |
HTML email templates sent for various events. Override path: emails/{filename}.php
| Template | Description |
|---|---|
emails/base.php |
Base email wrapper — header, footer, and layout shared by all emails |
emails/listing-submitted.php |
Sent to admin when a new listing is submitted for review |
emails/listing-approved.php |
Sent to the listing owner when their listing is approved |
emails/listing-rejected.php |
Sent to the listing owner when their listing is rejected |
emails/new-review.php |
Sent to the listing owner when a new review is posted |
emails/claim-submitted.php |
Sent to admin when a business claim request is submitted |
emails/claim-approved.php |
Sent to the claimant when their claim is approved |
emails/claim-rejected.php |
Sent to the claimant when their claim is rejected |
emails/listing-reported.php |
Sent to admin when a listing is reported by a visitor |
emails/weekly-digest.php |
Weekly summary email with directory statistics and activity |
Local Directory exposes a comprehensive set of CSS custom properties (also called CSS variables) on the :root element. These are reusable values you define once and use throughout your styles — change the value in one place, and it updates everywhere. Override any of them in your theme's stylesheet to customize the look and feel without touching template files.
| Property | Default | Description |
|---|---|---|
--ld-primary |
#1e40af |
Primary brand color |
--ld-primary-hover |
#1e3a8a |
Primary color on hover |
--ld-primary-light |
#dbeafe |
Light primary for backgrounds |
--ld-accent |
#f59e0b |
Accent color (stars, highlights) |
--ld-accent-hover |
#d97706 |
Accent color on hover |
--ld-success |
#10b981 |
Success states (verified badge, open now) |
--ld-success-light |
#d1fae5 |
Light success for backgrounds |
--ld-danger |
#ef4444 |
Danger/error states |
--ld-danger-light |
#fee2e2 |
Light danger for backgrounds |
--ld-warning |
#f59e0b |
Warning states |
--ld-warning-light |
#fef3c7 |
Light warning for backgrounds |
--ld-text |
#1f2937 |
Primary text color |
--ld-text-light |
#6b7280 |
Secondary text color |
--ld-text-muted |
#9ca3af |
Muted/placeholder text color |
--ld-border |
#e5e7eb |
Default border color |
--ld-border-light |
#f3f4f6 |
Light border for subtle dividers |
--ld-bg |
#ffffff |
Base background color |
--ld-bg-light |
#f9fafb |
Light background for cards |
--ld-bg-dark |
#f3f4f6 |
Darker background for sections |
| Property | Default | Description |
|---|---|---|
--ld-radius |
8px |
Default border radius for cards and containers |
--ld-radius-sm |
4px |
Small radius for badges, inputs |
--ld-radius-lg |
12px |
Large radius for modals, hero cards |
--ld-radius-full |
9999px |
Fully rounded (pills, avatars) |
| Property | Default | Description |
|---|---|---|
--ld-shadow |
0 1px 3px rgba(0,0,0,0.1) |
Default card shadow |
--ld-shadow-md |
0 4px 6px rgba(0,0,0,0.1) |
Medium shadow for dropdowns |
--ld-shadow-lg |
0 10px 15px rgba(0,0,0,0.1) |
Large shadow for modals |
--ld-shadow-hover |
0 4px 12px rgba(0,0,0,0.15) |
Elevated shadow on hover |
| Property | Default | Description |
|---|---|---|
--ld-transition |
0.2s ease |
Standard transition for interactive elements |
--ld-transition-slow |
0.3s ease |
Slower transition for panels, modals |
| Property | Default | Description |
|---|---|---|
--ld-font |
system-ui, -apple-system, "Segoe UI", Roboto, sans-serif |
Base font stack (inherits from your theme by default) |
| Property | Default | Description |
|---|---|---|
--ld-gap |
1rem |
Base gap between elements |
--ld-gap-lg |
1.5rem |
Large gap for sections |
--ld-gap-xl |
2rem |
Extra-large gap for page sections |
| Property | Default | Description |
|---|---|---|
--ld-focus-ring |
0 0 0 3px rgba(30, 64, 175, 0.3) |
Focus ring for keyboard navigation (uses primary color) |
Add this to your theme's style.css or the WordPress Customizer's Additional CSS to change the primary color to green:
/* Switch the directory to a green color scheme */
:root {
--ld-primary: #059669;
--ld-primary-hover: #047857;
--ld-primary-light: #d1fae5;
--ld-focus-ring: 0 0 0 3px rgba(5, 150, 105, 0.3);
}
Note: CSS custom properties cascade, so overrides placed in your theme stylesheet will automatically apply to all directory elements without specificity conflicts.
All CSS classes in Local Directory follow the BEM (Block Element Modifier) convention with an ld- namespace prefix. BEM is a naming system for CSS classes that makes them predictable and easy to customize — for example, .ld-listing is a block, .ld-listing__title is an element within it, and .ld-listing--featured is a modified variant. The ld- prefix avoids conflicts with your theme and other plugins.
ld-{block}__{element}--{modifier}
Block — A standalone component (e.g., ld-directory, ld-listing-card)
Element — A part of a block (e.g., ld-listing-card__badges)
Modifier — A variant or state (e.g., ld-listing-card--featured)
| Class | Type | Description |
|---|---|---|
.ld-directory |
Block | Main directory wrapper |
.ld-directory__search |
Element | Search area within the directory |
.ld-directory__view-btn |
Element | Grid/list view toggle button |
.ld-directory__view-btn--active |
Modifier | Currently selected view mode |
| Class | Type | Description |
|---|---|---|
.ld-listing-card |
Block | Individual listing card |
.ld-listing-card__badges |
Element | Badge container on the card |
.ld-listing-card__title |
Element | Listing name heading |
.ld-listing-card--featured |
Modifier | Featured/highlighted listing variant |
| Class | Type | Description |
|---|---|---|
.ld-search |
Block | Search component wrapper |
.ld-search__form |
Element | The search form element |
.ld-search__input |
Element | Individual search input field |
.ld-search--horizontal |
Modifier | Horizontal (inline) search layout |
Because all classes are namespaced with ld-, you can safely write selectors without worrying about theme conflicts:
/* Make featured listing cards stand out */
.ld-listing-card--featured {
border-color: var(--ld-accent);
box-shadow: var(--ld-shadow-hover);
}
/* Custom horizontal search layout */
.ld-search--horizontal .ld-search__form {
display: flex;
gap: var(--ld-gap);
align-items: center;
}
/* Larger directory view toggle buttons */
.ld-directory__view-btn {
padding: 0.5rem 1rem;
border-radius: var(--ld-radius-sm);
}
.ld-directory__view-btn--active {
background: var(--ld-primary);
color: #fff;
}
All templates use CSS logical properties (margin-inline-start, padding-inline-end, border-inline-start, etc.) instead of directional properties. This means the plugin renders correctly in both LTR and RTL languages without any additional stylesheets or overrides. When writing custom CSS for template overrides, follow the same convention to maintain RTL compatibility.
/* Use logical properties for RTL compatibility */
.ld-listing-card__badges {
/* Good */
margin-inline-start: auto;
padding-inline-end: 0.5rem;
/* Avoid */
/* margin-left: auto; */
/* padding-right: 0.5rem; */
}