1. Home
  2. Docs
  3. GeoDirectory Pages and Templates
  4. Archive Item Template

Archive Item Template



Introduction
Troubleshooting
Frequently Asked Questions
Support

Introduction

What

The Archive Item page template is a WordPress page that controls what shows up in the ‘mini listings’ shown throughout the site.. The contents of the page are the GeoDirectory Elements that are used to display listing data for each listing. Inside the template you will find default Elements that are installed with GD including GD Post Images, GD Output Location and more. Each of these Elements is responsible for showing one specific feature.

Every time GD Listings or GD Loop is used, the contents of the GD Archive Item template are queried, and each Element is rendered with the data of the listing at the URL being viewed.

Where

The GD Archive Item template is a WordPress page that is installed with GeoDirectory.
You can find the page by searching in the the Pages on your site in:

WordPress Backend – Pages – Search “gd” – hover over the Archive Item page and click edit to edit the page.

Examples

Directory Starter – https://wpgeo.directory/starter/places/
Supreme Directory – https://wpgeo.directory/supreme-directory/places/

DIrectory Starter Archive Item on Archive page for Places CPT.

GD Design Elements used in this Archive Item template shown above

GD Post Images
GD Post Title
GD Post Favorite
GD Post Content
GD Post Badge

GeoDirectory Settings

Default Template Setting

Choose the default GD Details template in the Pages settings:

GeoDirectory – Settings – General – Pages – Detail template – Choose your template page

Custom Post Types Template Override

When using the Custom Post Type addon, it is possible to set a different Archive Item template for each Custom Post Type (CPT). The setting for this is found in:

CPT Settings (ex. Places Settings) – General (tab) – Show Advanced – Archive Item template – Choose your template page

Personalize

GeoDirectory Design Elements

The following GD Elements are commonly used on the Archive Item template

GD Post Images – Display a single image or a slider
GD Post Title – Display the listing title as a link to the listing
GD Post Favorite – Display a link so visitors can add the listing to their list of favorites.
GD Post Content – Display the listing Description and set a max word count and design an optional ‘read more’ link.
GD Post Badge – New (last 30 days), Featured, Verified (is_claimed), Twitter, Facebook, and Website.
GD Output Location – Listings – Easily display a list of custom fields in your archive item with a single Element by using the Custom Fields Settings.
GD Post Meta – Display custom fields, categories, or tags.
GD Archive Item Open and Close – Simple containers to design your archive item into one or more rows and columns. Helps make listings look good in list view and grid layouts.

Default Content

When GeoDirectory is installed, the template is installed with default content. If you make changes to the page, and want to restore the default content, you can find it in the GeoDirectory Settings:

GeoDirectory – Settings – General – Pages – Click “Default Content”

The default content will be shown in a lightbox modal. You can copy and paste the default content back into the Page, overwriting anything you already have in the page.

More Design Options

GD Output Location -> Listings

You can adjust the properties of listing Custom Fields in the CPT Custom Fields Settings as described here.

One of the options is to “Show in extra output locations“.

Once you have chosen to display fields in the ‘Listings’ location, you will need to use the GD Output Location element in your Archive Item template to show those fields. Add the widget or shortcode to your Archive Item template and set it to display the “Listings” location.

[gd_output_location location="listing"]

Builders

You can use a builder on the Archive Item template. See more information here on the builders doc.

Customize

Customize with PHP Templates

You can create the Archive Item template with PHP. See our page here to get started.

Demo Content

The Archive Item from our demo


[gd_archive_item_section type='open' position='left']
[gd_post_images type='image' ajax_load='true' link_to='post' show_logo='true' show_title="1" ]
[gd_archive_item_section type='close' position='left']
[gd_archive_item_section type='open' position='right']
[gd_post_title tag='h2']

[gd_post_badge key="post_date" condition="is_less_than" search="+30" icon_class="fas fa-certificate" badge="New" bg_color="#ff0000" txt_color="#ffffff" alignment="left"]

[gd_post_badge key="featured" condition="is_not_empty" icon_class="fas fa-certificate" badge="Featured" bg_color="#ffb100" txt_color="#ffffff" alignment="left"]

[gd_post_badge key="claimed" condition="is_not_empty" search="+30" icon_class="fas fa-user-check fa-fw" badge="Verified" bg_color="#23c526" txt_color="#ffffff" alignment="left" list_hide_secondary="3"]
[gd_post_badge key="facebook" condition="is_not_empty" icon_class="fab fa-facebook-f fa-fw" link="%%input%%" new_window="1" bg_color="#2b4be8" txt_color="#ffffff" alignment="left"]
[gd_post_badge key="twitter" condition="is_not_empty" icon_class="fab fa-twitter fa-fw" link="%%input%%" new_window="1" bg_color="#2bb8e8" txt_color="#ffffff" alignment="left"]
[gd_post_badge key="website" condition="is_not_empty" icon_class="fas fa-link fa-fw" link="%%input%%" new_window="1" bg_color="#85a9b5" txt_color="#ffffff" alignment="left"]

[gd_author_actions author_page_only='1']
[gd_post_distance]
[gd_post_rating alignment='left' list_hide_secondary='2']
[gd_post_fav show='' alignment='right' list_hide_secondary='2']
[gd_post_meta key='business_hours' location='listing' list_hide_secondary='2']
[gd_output_location location='listing']
[gd_post_content key='post_content' limit='60' max_height='120'][gd_archive_item_section type='close' position='right']

Customizing

To use code snippets, see the doc about customizing.

Archive item Per Price Package

If you want to hide some information on different layouts/views, then see this doc first.

If you have the Pricing Manager installed you can use the following code snippet to select different archive items templates for each price package.

function gd_snippet_010619_archive_item_page_id( $page_id, $post_type ) {
	global $gd_post;
	
	if ( ! empty( $gd_post ) && ! empty( $gd_post->package_id ) ) {
		$package_id = $gd_post->package_id;

		if ( $package_id == 1 ) { // MATCH PACKAGE ID
			$page_id = 123; // ARCHIVE ITEM PAGE ID from PAGES
		} elseif ( $package_id == 2 ) {
			$page_id = 234;
		} elseif ( $package_id == 3 ) {
			$page_id = 567;
		}
	}
	
	return $page_id;
}
add_filter( 'geodir_archive_item_page_id', 'gd_snippet_010619_archive_item_page_id', 10, 2 );

Personalizing

GD Author Actions

By default, V2 includes GD Author Actions in the Archive Item template. However the option for “author page only” is enabled to improve performance. If edit links load on every display then that is less efficient than loading them only on the author page.

However, if you want to provide a list of listings for your listing owners to edit somewhere besides the author page, then that parameter must be disabled.

To do so, edit the Archive Item template and switch out the GD Author Actions shortcode to remove that option so that the edit buttons etc are shown on every page, instead of just the author page.

Articles

Was this article helpful to you? Yes No