Howdy, I'm trying to create a new template for events

Howdy, I’m trying to create a new template for events pulled in by the [eab_archive] shortcode. It looks like I am able to create a template in the root of my theme files and call it in via shortcode, but some of the stuff I’m trying to change is in the class_eab_template.php file.

Specifically, I’d like to change the wording of the get_events_date stuff; instead of saying Takes place on <var class="eab-date_format-date">%s</var> <span class="wpmudevevents-date_format-start">from <var class="eab-date_format-time">%s</var></span> I’d like it to say <var class="eab-date_format-date">%s</var> <span class="wpmudevevents-date_format-start"> — <var class="eab-date_format-time">%s</var></span>

How do I modify things in the class_eab_template.php file? Is there a way to write a filter in my functions.php file to overwrite it, so my changes don’t get lost when I update the plugin?

  • Vinod Dalvi
    • WP Unicorn

    Hi @SageMG,

    I hope you are well today and thank you for your question.

    To achieve this try adding the following code in the functions.php file of your child theme.

    function change_translate_text_wpmu( $translated_text, $text, $domain ) {

    if ( $domain == 'eab' && strpos( $translated_text, 'Takes place on <var class="eab-date_format-date">') !== false ) {
    $translated_text = str_replace('Takes place on', '', $translated_text);
    $translated_text = str_replace('from', '-', $translated_text);
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text_wpmu', 20, 3 );

    Best Regards,

    Vinod Dalvi

  • Gonzalo
    • WPMU DEV Initiate

    How can I replace the ‘and’ with ‘ ‘?

    I tried modifying your response to do the same, with no luck:

    function change_translate_text_wpmu2( $translated_text, $text, $domain ) {
    if ( $domain == 'eab' && strpos( $content, ' and ') !== false ) {
    $translated_text = str_replace(' and ', '', $translated_text);
    }
    return $translated_text;
    }
    add_filter( 'gettext', 'change_translate_text_wpmu2', 20, 3 );

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.