How to use GeoDirectory Conditional Tags

You may want to show widgets only on certain pages and GeoDirectory produces a wide variety of 'Conditional Tags' that can be used to turn a widget or block on or off. Interpreting and putting the Conditional Tag into action is done with custom code or a 3rd party plugin.

New to Conditional Tags? Read more about them here: https://codex.wordpress.org/Conditional_Tags

Common examples include:

geodir_get_current_posttype()=='gd_place' - show if post type is gd_place
is_singular( 'gd_place' ) - show if gd_place details page (single)
is_post_type_archive('gd_place') - archive for gd_place
is_tax( 'taxonomy-name', 'category-name' ) - specific category
is_post_type_archive('gd_place') && is_tax( 'taxonomy-name', 'category-name' ) - gd_place AND a specific category (BOTH)
is_front_page() - is the WP front page
geodir_is_page( 'add-listing' ) - GD Add listing page
geodir_is_page( 'location' ) – Determines whether current page is location page.
geodir_location_get_current( 'location' )	– Current location. Current Country or Region or City or Neighbourhood. Depends on current location type.
geodir_location_get_current( 'location_slug' ) – Current location. Current Country slug or Region slug or City slug or Neighbourhood slug. Depends on current location type.
geodir_location_get_current( 'id' )	– Location id. Only if city is set.
geodir_location_get_current( 'type' )	– Location type. One of from "country, region, city, neighbourhood, me, gps".
geodir_location_get_current( 'is_default' )	– Is default location. Only if city is set.
geodir_location_get_current( 'country' )	– Country name. Ex: United Kingdom.
geodir_location_get_current( 'country_slug' ) – Country slug. Ex: united-kingdom.
geodir_location_get_current( 'region' )	– Region name. Ex: Greater London.
geodir_location_get_current( 'region_slug' )	– Region slug. Ex: greater-london.
geodir_location_get_current( 'city' )	– City name. Ex: London
geodir_location_get_current( 'city_slug' )	– City slug. Ex: london.
geodir_location_get_current( 'neighbourhood' )	– Neighbourhood name. Ex: Camden Town.
geodir_location_get_current( 'neighbourhood_slug' )	– Neighbourhood slug. Ex: camden-town.
geodir_location_get_current( 'latitude' )	– Latitude. Only if city or neighbourhood or gps/me is set. Ex: 51.4587232758
geodir_location_get_current( 'longitude' )	– Longitude. Only if city or neighbourhood or gps/me is set. Ex: -0.1956555088
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