Customizing templates

GeoDirectory template files contain the code and template structure for the frontend of your site and HTML emails sent by your system.
GD uses Bootstrap styles by default. Customizing templates means moving a copy of a GD file to your folder, and that needs to include a Bootstrap sub-folder, ex.

copy .../wp-content/plugins/geodirectory/templates/bootstrap/map/map-popup.php 
to     .../wp-content/themes/your-theme/geodirectory/bootstrap/map/map-popup.php

  • Templates can be found at .../wp-content/plugins/ geodirectory/templates
  • Email templates can be found at .../ wp-content/plugins/geodirectory/templates/emails
When you open these files, you will notice they all contain hooks that allow you to customize content without needing to edit the template files themselves. This method protects you from losing your customization when updating your plugins, because the template files can be left completely untouched.

Editing template files

To keep your customization safe from plugin updates, you should create copies of the templates in your theme folder.  Do not edit these files within the core plugin itself as they are overwritten during the upgrade process and any customization will be lost.

Copy the template into a folder within your (child) theme named /geodirectory/ keeping the same file structure as within the plugin files, but remove the /templates/ sub-folder.

Example 1: frontend template

To override the map bubble template file when you use the Whoop theme, copy the
.../wp-content/plugins/geodirectory/templates/map-popup.php file to .../wp-content/themes/whoop/geodirectory/map-popup.php

The copied file will now override the GeoDirectory default template file. 

However, bear in mind that when AyeCode UI (Bootstrap) is active, you need to copy the  .../wp-content/plugins/geodirectory/templates/bootstrap/map/map-popup.php file to .../wp-content/themes/your-theme/geodirectory/bootstrap/map/map-popup.php

Example 2: Email template

To override the email footer template file when you use the Supreme theme, copy the 
.../wp-content/plugins/geodirectory/templates/emails/geodir-email-footer.php
file to
.../wp-content/themes/supreme-directory/geodirectory/emails/geodir-email-footer.php

The copied file will now override the GeoDirectory default email footer file.

Example 3: PHP for GD Custom Fields

$maybe_meta = geodir_get_post_meta( $object_id, $meta_key, $single );

Try the geodir_get_post_meta() function to retrieve the GD custom field value for the GD listing (see https://github.com/AyeCode/geodirectory/blob/master/includes/post-functions.php#L233).

Example:$email = geodir_get_post_meta( $post_id, 'email', true );

Try the geodir_save_post_meta() function to update the GD custom field value for the GD listing (see https://github.com/AyeCode/geodirectory/blob/master/includes/post-functions.php#L104).

Example:geodir_save_post_meta( $post_id, 'email', '[email protected]' );
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us