GeoDirectory shows the address in two ways. The GD > Post Address block has its own Address template setting. Where the address appears as an output location of the Address field (the details page sidebar, the listings page and the map bubble), GeoDirectory uses a default template that puts each part on a new line. You can replace that default with a filter, or use the block in those places.
Address template tags
Templates are built from these tags: %%street%%, %%neighbourhood%%, %%city%%, %%region%%, %%country%%, %%zip%%, %%latitude%%, %%longitude%%, %%post_title%% and %%br%%. Adding _br to a tag puts a line break after it, and _brc a comma and a line break. For example, %%street_br%% %%city%%, %%region%% %%zip%% gives the street on one line and “City, Region Zip” on the next.
Option 1: change the default template with a filter
The geodir_cf_address_template filter changes the template for the Address field outputs. Its third argument is the output location, so you can limit it to the places you want:
add_filter( 'geodir_cf_address_template', 'my_gd_address_template', 10, 3 );
function my_gd_address_template( $template, $cf, $location ) {
if ( in_array( $location, array( 'detail', 'listing', 'mapbubble' ), true ) ) {
$template = '%%street_br%% %%city%%, %%region%% %%zip%%';
}
return $template;
}
GD > Post Address blocks pass none as their location, so this snippet leaves their own templates alone. Add it with the Code Snippets plugin or your child theme’s functions.php.
Option 2: use GD > Post Address in your templates
- Add GD > Post Address with your template to the archive item template, and to the Details page template or sidebar.
- In Places > Settings > Custom Fields, edit the Address field and untick the matching places in “Show in extra output location” (Details page sidebar, Listings page), so the address doesn’t appear twice.
The map bubble is a PHP template (map-popup.php) rather than a page. Option 1 covers its address, and if you want to change the whole bubble you can copy the template into your theme as explained in Customizing templates.