Support » Plugin: The Events Calendar » Replacing “Now onwards” text

  • Resolved amillionmiles

    (@amillionmiles)


    Hi,
    Like many others, I’m trying to replace the “Now onwards” text that appears in the list view. I don’t want to translate it, but it just sounds bad to me, and I’d rather have it say “Upcoming” instead. I noticed that your demo does exactly that, but my plugin doesn’t. I have the latest update (Version 5.7.0). I don’t want to add a plugin for this small change.
    I tried adding this to functions.php with no success:

    $custom_text = [
      'onwards' => 'Upcoming',
    ];

    I also tried adding a JS file with this:

    <script type="text/javascript">
    
    jQuery("span.tribe-events-c-top-bar__datepicker-desktop").text(function () {
    return jQuery(this).text().replace("Now onwards", "Upcoming");
    });
    
    </script>

    I also tried following the suggestion from this post, but it appears to be outdated.

    How can I change this so that it looks like the demo?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support Ali Darwich

    (@tokyobiyori)

    SUPER-O EL MOPO

    Hello!

    Thanks so much for your message! Would you mind trying this?

    function tribe_custom_theme_text ( $translation, $text, $domain ) {
    	// If this text domain doesn't start with "tribe-", "the-events-", or "event-" bail.
    	$is_tribe = strpos($domain, 'tribe-') !== false;
    	$is_tec =  strpos($domain, 'the-events-') !== false;
    	$is_event = strpos($domain, 'event-') !== false;
    	if(  ! (  $is_tec || $is_tribe || $is_event) ) {
    		return $translation;
    	}
    	// Put your custom text here in a key => value pair
    	// Example: 'Text you want to change' => 'This is what it will be changed to'
    	// The text you want to change is the key, and it is case-sensitive
    	// The text you want to change it to is the value
    	// You can freely add or remove key => values, but make sure to separate them with a comma
    	// This example changes the label "Venue" to "Location", "Related Events" to "Similar Events", and "(Now or date) onwards" to "Calendar - you can discard the dynamic portion of the text as well if desired.
    	$custom_text = [
    		'Venue' => 'Location',
    		'Related %s' => 'Similar %s',
    		'%s onwards' => 'Calendar',
    	];
    	// If we don't have replacement text in our array, return the original (translated) text.
    	if ( empty( $custom_text[$translation] ) ) {
    		return $translation;
    	}
    	return $custom_text[$translation];
    }
    // base
    add_filter('gettext', 'tribe_custom_theme_text', 20, 3);

    Instead of this bit here:

    $custom_text = [
    		'Venue' => 'Location',
    		'Related %s' => 'Similar %s',
    		'%s onwards' => 'Calendar',

    Try this:

    $custom_text = [
    		'%s onwards' => 'Upcoming',

    Let me know how it goes!

    Plugin Support James Welbes

    (@highprrrr)

    Hey there! This thread has been inactive for a while so we’re going to go ahead and mark it Resolved. Please feel free to open a new thread if any other questions come up and we’d be happy to help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.