Short Country format

Home Forums Calendar Products Events Calendar PRO Short Country format

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #46823
    Tineke
    Participant

    hi there,

    In another (closed) discussion I saw Barry saying the following on getting a short country format:
    “I don’t believe there are any specific filters for that template tag; you could use tribe_get_event_meta but that’s further upstream.
    Do note however that tribe_get_country() returns its output rather than echoing it, so you could easily filter it yourself by creating a new template tag of your own which converts tribe_get_country()’s output to an abbreviated format (whether that’s ISO 3166 or some other scheme).”

    I was wondering if someone could explain me how to do this?

    #46878
    Barry
    Member

    If you take a look at this snippet you should get an idea of how you might do this – per the comments it isn’t the very neatest way of doing this, especially if you are likely to be processing a wide range of countries, but it should give you a starting point if nothing else.

    If you haven’t done so already, take a look at our Themer’s Guide (link in the Useful Resources section on the right) for a primer on how to customize and override templates.

    Cheers!

    #46926
    Tineke
    Participant

    Thanks Barry. But I wasn’t looking to change it everywhere. Just in list.php where I have this:
    $country = tribe_get_country(); if ( !empty( $country ) ) : echo $country; endif;

    #46929
    Tineke
    Participant

    I just solved it with this (which is not a full list):

    #46930
    Tineke
    Participant

    $country = tribe_get_country();
    if ($country==”Netherlands”) {
    echo “NL” ;
    } elseif ($country==”Denmark”) {
    echo “DK”;
    } elseif ($country==”Afghanistan”) {
    echo “AF”;
    } elseif ($country==”Denmark”) {
    echo “DK”;
    } elseif ($country==”Argentina”) {
    echo “AR”;
    } elseif ($country==”Australia”) {
    echo “AU”;
    } elseif ($country==”Austria”) {
    echo “AT”;
    } elseif ($country==”Belgium”) {
    echo “BE”;
    } elseif ($country==”Brazil”) {
    echo “BR”;
    } elseif ($country==”Bulgaria”) {
    echo “BG”;
    } elseif ($country==”Canada”) {
    echo “CA”;
    } elseif ($country==”Chile”) {
    echo “CL”;
    } elseif ($country==”China”) {
    echo “CN”;
    } elseif ($country==”Colombia”) {
    echo “CO”;
    } elseif ($country==”Czech Republic”) {
    echo “CZ”;
    } elseif ($country==”Denmark”) {
    echo “DK”;
    } elseif ($country==”France”) {
    echo “F”;
    } elseif ($country==”Germany”) {
    echo “DE”;
    } elseif ($country==”Greece”) {
    echo “GR”;
    } elseif ($country==”Italy”) {
    echo “IT”;
    } elseif ($country==”Japan”) {
    echo “JP”;
    } elseif ($country==”Luxembourg”) {
    echo “LU”;
    } elseif ($country==”Luxembourg”) {
    echo “ZA”;
    } elseif ($country==”Spain”) {
    echo “ES”;
    } elseif ($country==”South Africa”) {
    echo “LU”;
    } elseif ($country==”Suriname”) {
    echo “SR”;
    } elseif ($country==”Sweden”) {
    echo “SE”;
    } elseif ($country==”Switzerland”) {
    echo “CH”;
    } elseif ($country==”United Arab Emirates”) {
    echo “UAE”;
    } elseif ($country==”United States”) {
    echo “US”;
    } elseif ($country==”United States”) {
    echo “US”;
    } elseif ($country==”Venezuela”) {
    echo “VE”;
    } else {
    echo tribe_get_country();
    }

    #46954
    Barry
    Member

    Excellent, glad you’re all sorted 🙂

    #979003
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Short Country format’ is closed to new replies.