Forums

Geo Mashup
[resolved] location_info field=adress - without country? (4 posts)

  1. arthurdent2003
    Member
    Posted 11 months ago #

    Hi!

    I have tried to figure out how to show the address on a place on a webpage- I figuered out now, thanks to the documentation of geo mashup.

    [geo_mashup_location_info fields="address"]

    When I use the shortcode above, the following informations show up: Street + Streetnumber, Postcode, City, Country

    But how can I just tell to show up (no country?):
    Street + Streetnumber, Postcode, City

    Thank you!

    AD

    http://wordpress.org/extend/plugins/geo-mashup/

  2. Dylan Kuhn
    Member
    Posted 11 months ago #

    The "address" field contents depend on a number of changeable factors, and may not always contain the fields you're looking for. You're right, though - it is the only field that can contain street information.

    If you manually make sure you always have a street address when you're adding the location, you might be able to get away with making your own shortcode in your theme's functions.php or equivalent:

    function ad_address( $unused ) {
      $gm_location = GeoMashup::current_location();
      if ( !$gm_location )
        return '';
      $address_parts = explode( ', ', $gm_location->address );
      if ( count( $address_parts ) < 2 ) )
        return '';
      array_pop( $address_parts );
      return implode( ', ', $address_parts );
    }
    add_shortcode( 'ad_address', 'ad_address' );

    Written off the cuff, but if that's right then [ad_address] would give you the address without the last item.

  3. arthurdent2003
    Member
    Posted 11 months ago #

    Dear Dylan,

    really great. I do appreciate your effort very much!

    it works for me!

    function ad_address( $unused ) {
      $gm_location = GeoMashup::current_location();
      if ( !$gm_location )
        return '';
      $address_parts = explode( ', ', $gm_location->address );
      if ( count( $address_parts ) < 2 )
        return '';
      array_pop( $address_parts );
      return implode( ', ', $address_parts );
    }
    add_shortcode( 'ad_address', 'ad_address' );

    Thank you. I really do like your plugin a lot! Thank you for the development and support! Great!

    AD

  4. Dylan Kuhn
    Member
    Posted 11 months ago #

    Cheers, share the love :)

Reply

You must log in to post.

About this Plugin

About this Topic