• Resolved arthurdent2003

    (@arthurdent2003)


    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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Dylan Kuhn

    (@cyberhobo)

    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.

    Thread Starter arthurdent2003

    (@arthurdent2003)

    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

    Plugin Author Dylan Kuhn

    (@cyberhobo)

    Cheers, share the love 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Geo Mashup] location_info field=adress – without country?’ is closed to new replies.