WordPress.org

Support

Support » Plugins and Hacks » How to display the country in SimpleMap?

How to display the country in SimpleMap?

  • Everything looks great, except that I can’t seem to display the country name. The country field collects the data in the Add-a-Location window. But then the country name does not display as part of the address in the listing below the map display, nor in the Info Bubble. The only options I see are in the Address Format drop down, and they do not include a country field. [city/town] – [state/province] [zip/postal code]. Is there a way to add [country] to this selection? thanks-ab

Viewing 4 replies - 1 through 4 (of 4 total)
  • I´m trying to do the same… I know that has something to do with the simplemap.php on …/plugins/simplemap/classes/ but i cant manage it to work. I also need to make a search TD for it…

    :/ is so basic yet so not there.

    ../plugins/simplemap/classes/simplemap.php

    do a search for this string : <address>

    You ‘ll see there are 7 entries for <address>
    Pick the one that you currently have set in your admin (you could also put some debug text in all of them and print them out to see what displays on the front-end

    and then just add ‘country’ to that line

    like so
    html += '<br />' + city + ', ' + state + ' ' + zip + '(' + country + ')</address></div>';

    Mind you : this just adds the SHORTCODE of the country (like ES for Spain) etc …
    if you want the full country code you’de have to convert those shortcodes to full country names first obviously …

    I know this post is old but this is information that should be in the forum.

    To add the Country field into the search form (all the code already exists for this functionality, but for some reason it is disabled by default), one must use one of the many undocumented shortcode attributes.

    [simplemap search_fields=labelbr_street||labelbr_city||labelbr_state|| labelbr_zip||labelbr_country||empty||labeltd_distance||empty]

    You can take a look at all of the shortcode attributes in simplemap.php by looking at the get_default_shortcode_atts function.

    P.S. I don’t know why the developer doesn’t provide some basic docs for free. He should. If he wants to make money on the plugin, branch the code and create a paid version.

    Seriously chaoix is right…. Developer – why make a plugin and provide little-to-no documentation or ‘getting started’ info? You clearly have the mind of a developer and not a marketer. Why sell support when you could sell much more than that?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to display the country in SimpleMap?’ is closed to new replies.