Support

Home Forums Event Espresso Premium A Few Little Changes

A Few Little Changes

Posted: October 16, 2015 at 4:49 am


goneilbell

October 16, 2015 at 4:49 am

Hi

Could you please let me know how to amend the following:

The “Qty” in ticket selection tables needs to be changed to “Select” for example: http://www.teachersfp.co.uk/seminars/liverpool-retirement-seminar

“Goes on Sale” in the same table needs to be changed to “Available From” (as above)

Could the “Book now” buttons be changed to “Book Seminar” : http://www.teachersfp.co.uk/seminars

Could the button at the bottom of the registration page be amended to the English “Finalise” : http://www.teachersfp.co.uk/registration-checkout/#checkout

Thanks

Ged


Tony

  • Support Staff

October 16, 2015 at 5:23 am

Hi Ged,

For ‘Qty*’, ‘Goes on Sale’ and ‘Finalize’ the easiest way to make those changes is to translate the text. There’s a couple of ways this can be done but for a few text strings the best solution is a Site Specific Plugin using this function:

function mycustom_filter_gettext( $translated, $original, $domain ) {
 
    // This is an array of original strings
    // and what they should be replaced with
    $strings = array(
        'Qty*' => 'Select',
        'Goes On Sale:' => 'Available From:',
        'Goes On Sale' => 'Available From',
        'Finalize Registration' => 'Finalise Registration',
        // Add some more strings here
    );
 
    // See if the current string is in the $strings array
    // If so, replace its translation
    if ( isset( $strings[$original] ) ) {
        // This accomplishes the same thing as __()
        // but without running it through the filter again
        $translations = get_translations_for_domain( $domain );
        $translated = $translations->translate( $strings[$original] );
    }
 
    return $translated;
}
 
add_filter( 'gettext', 'mycustom_filter_gettext', 10, 3 );

Currently the ‘Book now’ buttons show ‘Book Course’, I’m not sure where ‘Course’ is being pulled from and those buttons are not the default buttons from Event Espresso.

Is that archive page a custom template you have created?

  • This reply was modified 8 years, 7 months ago by  Tony. Reason: Add additional string


goneilbell

October 18, 2015 at 2:48 pm

Hi Tony

Apologies for the late reply and thanks for the above!

I’ve created the Site Specific Plugin in the editor it now looks like this:

<?php
/*
Plugin Name: Site plugin for teachersfp.co.uk
Description: Site specific code for teachersfp.co.uk
*/
/* Begin Adding Functions Below This Line; Do not include an opening PHP tag as this sample code already includes one! */

function mycustom_filter_gettext( $translated, $original, $domain ) {

// This is an array of original strings
// and what they should be replaced with
$strings = array(
‘Qty*’ => ‘Select’,
‘Goes On Sale:’ => ‘Available From:’,
‘Finalize Registration’ => ‘Finalise Registration’,
// Add some more strings here
);

// See if the current string is in the $strings array
// If so, replace its translation
if ( isset( $strings[$original] ) ) {
// This accomplishes the same thing as __()
// but without running it through the filter again
$translations = get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}

return $translated;
}

add_filter( ‘gettext’, ‘mycustom_filter_gettext’, 10, 3 );

/* Stop Adding Functions */

But this does not seem to have altered the text in the table. Could you please have a look and possibly make some suggestions.

Thanks

Ged


goneilbell

October 18, 2015 at 2:57 pm

Hi Tony

Schoolboy error – I forgot to activate it!

Thanks

Again!


goneilbell

October 18, 2015 at 3:02 pm

Hi Tony

All is looking good apart from Goes On Sale is still showing as Goes On Sale – Any ideas why that might be?

Thanks

Ged


Lorenzo Orlando Caum

  • Support Staff

October 18, 2015 at 4:19 pm

Hi Ged,

The messaging for goes on sale in the ticket selector has some spacing like this:

Goes On Sale

http://cl.ly/image/0i2m003l0U1o

Please change that entry in the example code that you added and then it should start working.


Lorenzo


goneilbell

October 19, 2015 at 2:26 am

Spot on thanks a lot!

Ged


Tony

  • Support Staff

October 19, 2015 at 3:58 am

Hi Ged,

Apologies, it seems I’m looking in a different location to yourself.

The code I included changes the string within the ticket details – http://take.ms/UDBozf

So you may actually won’t to include both of those strings to change the details section also (I’ve updated my example to include both)

The support post ‘A Few Little Changes’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso