• Resolved eamonncoyne

    (@eamonncoyne)


    Hi,

    Is it possible to add the six counties of Northern Ireland to the county drop-down for Ireland? A lot of people living in Northern Ireland don’t like to list their country as the United Kingdom and therefore cannot add their correct county.

    Also, there’s a funny little dance you have to do to change the county when you change the country e.g. when you change the country from Ireland to UK it still shows Irish counties unless you save in between – then you can make the change.

    Thanks and Happy New Year,
    éamonn

Viewing 6 replies - 1 through 6 (of 6 total)
  • Thread Starter eamonncoyne

    (@eamonncoyne)

    Hi,

    No probs on first thing above; I just added them to the Get Ireland States (sic!) list in give/includes/country-functions.php file.

    2nd question might be worth looking at however.

    Also, where did you get your 2 letter abbreviations for Irish counties from? 3 letters seems the normal convention.

    éamonn

    Hi @eamonncoyne ,

    I’m struggling to find the link for this – can you point me in the right direction, please?

    Many thanks,
    Sean

    Thread Starter eamonncoyne

    (@eamonncoyne)

    Hi,

    Firstly I see that this is still open with no replies and Give have always been more on top of their support but maybe it was fixed in an update or un-reproducible etc. and just didn’t get updated here.

    Anyway @deadl in the give/includes/country-functions.php file I added the following to the list of Irish States that starts at line 1502 (fitting them within the existing alphabetical ordering).

    ‘AN’ => __( ‘Antrim’, ‘give’ ),
    ‘AR’ => __( ‘Armagh’, ‘give’ ),
    ‘DY’ => __( ‘Derry’, ‘give’ ),
    ‘DO’ => __( ‘Down’, ‘give’ ),
    ‘FM’ => __( ‘Fermanagh’, ‘give’ ),
    ‘TR’ => __( ‘Tyrone’, ‘give’ ),

    That gave me those counties in the list under Ireland.

    Hope that helps,
    éamonn

    Thanks @eamonncoyne !
    Saved my bacon with this one!

    Plugin Author Matt Cromwell

    (@webdevmattcrom)

    Thanks everyone for the community support. Great to see fellow Give users helping each other out!

    I do want to chime in and provide a more best practices approach to making this update. Changing the core Give files will mean you lose your changes in every plugin update. Instead of that, use this filter:

    add_filter('give_ireland_states', 'custom_give_ireland_states');
    
    function custom_give_ireland_states() {
        $states = array(
            ''   => '',
            'AN' => __( 'Antrim', 'give' ),
            'AR' => __( 'Armagh', 'give' ),
            'CE' => __( 'Clare', 'give' ),
            'CK' => __( 'Cork', 'give' ),
            'CN' => __( 'Cavan', 'give' ),
            'CW' => __( 'Carlow', 'give' ),
            'DL' => __( 'Donegal', 'give' ),
            'DN' => __( 'Dublin', 'give' ),
            'DO' => __( 'Down', 'give' ),
            'DY' => __( 'Derry', 'give' ),
            'FM' => __( 'Fermanagh', 'give' ),
            'GY' => __( 'Galway', 'give' ),
            'KE' => __( 'Kildare', 'give' ),
            'KK' => __( 'Kilkenny', 'give' ),
            'KY' => __( 'Kerry', 'give' ),
            'LD' => __( 'Longford', 'give' ),
            'LH' => __( 'Louth', 'give' ),
            'LK' => __( 'Limerick', 'give' ),
            'LM' => __( 'Leitrim', 'give' ),
            'LS' => __( 'Laois', 'give' ),
            'MH' => __( 'Meath', 'give' ),
            'MN' => __( 'Monaghan', 'give' ),
            'MO' => __( 'Mayo', 'give' ),
            'OY' => __( 'Offaly', 'give' ),
            'RN' => __( 'Roscommon', 'give' ),
            'SO' => __( 'Sligo', 'give' ),
            'TR' => __( 'Tyrone', 'give' ),
            'TY' => __( 'Tipperary', 'give' ),
            'WD' => __( 'Waterford', 'give' ),
            'WH' => __( 'Westmeath', 'give' ),
            'WW' => __( 'Wicklow', 'give' ),
            'WX' => __( 'Wexford', 'give' ),
        );
    
        return $states;
    }

    If you need guidance implementing custom PHP functions on your website, we have this guide here: https://givewp.com/documentation/resources/adding-custom-functions-to-your-wordpress-website/

    Lastly, I also created an issue for our devteam to resolve this issue so you won’t have to worry about updating the files OR using the snippet either in the future. You can track our progress on that here:
    https://github.com/impress-org/give/issues/4145

    Thanks!

    Thread Starter eamonncoyne

    (@eamonncoyne)

    Thanks Matt,

    I see it has been included in the recent update. Very nice to see my little bit of work and suggestion included and I can delete the custom function code now.

    éamonn

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Add to Ireland Counties list’ is closed to new replies.