preloader

How to Customize GeoDirectory Listing Templates Without Breaking Updates

GeoDirectory loads templates from its own plugin directory first. If it finds a matching template file inside a geodirectory/ subfolder in your active child theme, it uses that instead. This is the same override pattern WooCommerce uses – safe, maintainable, and update-proof when done correctly.

Understanding Which Template Controls What

GeoDirectory templates live in wp-content/plugins/geodirectory/templates/. The most important ones for customisation: content-listing.php controls the single listing page layout; archive-listing.php controls the listings archive and search results page; and templates/widget-listing/post_type-business.php controls the individual listing card that appears in archive and search result grids. Before editing anything, open these files to understand their structure and which PHP functions output which data.

Setting Up Your Override Directory

In your child theme directory, create a folder named geodirectory/. Inside it, mirror the directory structure of GeoDirectory’s templates folder. To override the listing card, copy the file from the plugin into your child theme:

FROM: wp-content/plugins/geodirectory/templates/widget-listing/post_type-business.php
TO:   wp-content/themes/your-child-theme/geodirectory/widget-listing/post_type-business.php

GeoDirectory checks for the override file on every page load. No cache clearing or configuration needed – the override takes effect immediately after the file is in place.

Need a developer to implement this? Describe your project and get a free estimate.

Useful GeoDirectory Template Functions

Inside overridden templates, use GeoDirectory’s own functions to output listing data rather than raw get_post_meta() calls. The built-in functions handle formatting, escaping, and fallbacks:

geodir_the_title();           // Listing title
geodir_the_address();         // Formatted address
geodir_the_phone();           // Phone number as link
geodir_the_website();         // Website URL as link
geodir_the_rating();          // Star rating display
geodir_custom_fields_detail(); // All custom fields in order
geodir_comments();            // Reviews section

For custom fields specifically, retrieve the value directly when you need it outside of geodir_custom_fields_detail():

$value = get_post_meta(get_the_ID(), 'field_key', true);

GeoDirectory stores custom field values using the field key you configured in GeoDirectory -> Settings -> Custom Fields.

Using Hooks Instead of Full Overrides

For adding content to specific positions without replacing entire template files, GeoDirectory provides action hooks. A hook-based addition survives plugin updates because you are not replacing a file – your code runs alongside GeoDirectory’s templates:

// Add a verified badge before the title on single listing pages
add_action('geodir_before_listing_title', function() {
    if (get_post_meta(get_the_ID(), 'gd_verified', true)) {
        echo '<span class="listing-verified">Verified</span>';
    }
});

// Add a directions link after the address
add_action('geodir_after_listing_address', function() {
    echo '<a href="#gd-map">View on Map</a>';
});

Keeping Overrides Current After Plugin Updates

GeoDirectory includes a version comment at the top of each template file, like This template was created in version 2.0.0.1. When the plugin updates, compare the version in your override against the new version in the plugin. If they differ, review the diff between the two versions and update your override to incorporate any necessary changes. GeoDirectory displays admin notices when your theme’s overridden templates are behind the plugin’s current version – pay attention to these after every GeoDirectory update.

Overriding the Listing Card Template

The listing card is the element visitors see most often – it appears in archive pages, search results, and widget outputs. Small improvements to the card (adding a phone number, showing a price range badge, changing the image crop) have significant impact on user experience. After creating your override at your-child-theme/geodirectory/widget-listing/post_type-business.php, locate the section of the card where you want to make changes.

To add a custom attribute value below the address in the listing card, find where the address is output in the template and add after it:

$opening_hours = get_post_meta(get_the_ID(), 'business_hours_today', true);
if ($opening_hours) {
    echo '<div class="listing-hours">' . esc_html($opening_hours) . '</div>';
}

Overriding the Single Listing Page

The single listing page is where visitors make their decision – call the business, visit the website, or leave. A well-structured single listing page with clear contact information, quality photos, and reviews in the right order converts better than a default template. Copy content-listing.php from the GeoDirectory templates folder to your child theme’s geodirectory/ folder and rearrange sections to match your directory’s priorities.

For a restaurant directory, the priority order might be: photos first, then cuisine and hours, then address and phone, then menu link, then reviews. The default order may not match this – rearranging template sections in your override produces a page better suited to how restaurant searchers make decisions.

Performance: Avoid Loading Template Functions You Do Not Use

GeoDirectory templates load several helper functions and assets on every listing page. When you override a template, remove calls to functions that render sections you have removed from the layout. Leaving calls to geodir_comments() on a listing type where reviews are disabled wastes a database query on every page load. Review your overridden templates for unused function calls and remove them to keep listing pages as lean as possible.

Keep Reading

Previous Post Setting Up Stripe for HivePress Marketplace Payouts Next Post Adding Custom Fields to HivePress Listings With Code

Need Help With Your WordPress Site?

If you need help with WordPress fixes, plugin issues, theme customization, or development work, feel free to get in touch.

Get a Free Estimate