• Based on the post from Jonah West, “Change Events Calendar Strings Without Editing Language Files”

    URL: http://tri.be/change-events-calendar-strings-without-editing-language-files/

    Add reading up on ‘gettext’, I created a function to modify fields single event admin page for “The Events Calendar” since Jonah’s code only modifies the public page. I’ve run into an issue with the text modification for “Phone:” under “Event Location Details” to display “Venue Phone;”. This works correctly but the function also updates “Phone:” under the Event Organizer Details to also display “Venue Phone:”.

    I have been searching for an solution to refine my Switch/Case statement to either “EventPhone” or “venue[Phone]”. So far I haven’t found any options.

    Can someone from Modern Tribe help? I am developing this on a local site before I upload the code to the Events Pro site. So, I don’t have a URL to show at the moment.

    Here is the code for my function, “theme_change_admin_field_name”.

    add_filter( 'gettext', 'theme_change_admin_field_names', 20, 3 );
    /**
     * Change comment form default field names.
     *
     * @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
     */
    function theme_change_admin_field_names( $translated_text, $text, $domain ) {
    
        if ( is_admin() ) {
    
            switch ( $translated_text ) {
    
                case 'Organizer Name:' :
    
                    $translated_text = __( 'Contact:', 'theme_text_domain' );
                    break;
    
                case 'Phone:' :
    
                    $translated_text = __( 'Venue Phone:', 'theme_text_domain' );
                    break;
    
            }
    
        }
    
        return $translated_text;
    }
  • The topic ‘Change Events Calendar Admin Form Strings using a function’ is closed to new replies.