Home › Forums › Calendar Products › Events Calendar PRO › Functions aren't changing labels or words in the List Widget
- This topic has 10 replies, 2 voices, and was last updated 10 years, 7 months ago by
George.
-
AuthorPosts
-
September 20, 2015 at 8:56 pm #1006927
MIKE
ParticipantSo I’m using the following functions:
/* * CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR */ function tribe_custom_theme_text ( $translations, $text, $domain ) { // 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”, and “Related Events” to “Similar Events” $custom_text = array( 'Venue' => 'Location', 'Venues' => 'Locations', 'Organizers' => 'Instructors', 'Organizer' => 'Instructor' ); // If this text domain starts with “tribe-“, and we have replacement text if(strpos($domain, 'the-') === 0 && array_key_exists($text, $custom_text) ) { $text = $custom_text[$text]; } return $text; } add_filter('gettext', 'tribe_custom_theme_text', 20, 3); // Change VENUE to LOCATION function filter_translations($translation, $text, $domain) { if ($domain == 'the-events-calendar') { switch ($text) { case 'Organizer': $translation = 'Instructor'; break; } } return $translation; } add_filter('gettext', 'filter_translations', 10, 3);However, the changes aren’t being made to the List Widget.
September 21, 2015 at 5:30 pm #1007298George
ParticipantI’m sorry this isn’t working, @MIKE – for starters, I think you’ll have much better luck using the new method for doing this which is described (with example code) in the knowledgebase article here → https://theeventscalendar.com/knowledgebase/relabeling-the-venue-organizer-sections-in-event-meta/
That should make a difference – let me know if it does, or if your List Widget still seems to not be affected. If this is latter situation is the case, then I’d recommend that you share your System Information if possible (learn how to do that here → https://theeventscalendar.com/knowledgebase/sharing-sys-info/).
Cheers!
GeorgeSeptember 21, 2015 at 6:16 pm #1007320MIKE
ParticipantThis reply is private.
September 22, 2015 at 7:49 am #1007501George
ParticipantHey @MIKE,
Thanks for the system information! Nothing looks out of the ordinary there, so I’m wondering, when you mention having tried the method I linked to already, did you place that code in your theme’s functions.php file? If so, can you add it back to your functions.php file like you did before, and see if it works any better? If it doesn’t work any better, then can you paste your ENTIRE functions.php file, un-edited in full, into a Gist at http://gist.github.com and then share a link to that Gist here?
There may be a problem that I can spot from this, as that method should be working and is a better method than the gettext method you posted in your first post on this thread.
Thank you for your patience!
— George
September 22, 2015 at 6:48 pm #1007689September 23, 2015 at 8:26 am #1007883George
ParticipantHey @MIKE,
Thanks for this! To be clear, with the second style of venue and organizer-related label code in place, can you remove the first method you’ve added at the top of your functions.php file?
Does this help at all? I’ve checked our code and these labels should be changing – let me know if this helps.
If not, then can you take a screenshot of the labels on your site that are not changing? Then, upload this screenshot to a site like Imgur.com or something, and share the URL in your reply here so we can see it…
Thank you for your patience here!
September 23, 2015 at 8:49 am #1007895MIKE
ParticipantOk, now I’ve edited it to
https://gist.github.com/anonymous/ab396513824b1f9b8b33
and it’s still not changing.
September 23, 2015 at 9:49 am #1007916MIKE
ParticipantOh, here’s why.
In pro/widgets/modules/single-event.php it’s hard coded:<?php if ( isset( $organizer ) && $organizer && tribe_get_organizer() != '' ): ?> <span class="tribe-organizer"> <?php esc_html_e( 'Organizer:', 'tribe-events-calendar-pro' ); ?> <?php echo tribe_get_organizer_link(); ?> </span> <?php endif ?>[sad face]
September 24, 2015 at 6:48 am #1008222George
ParticipantHey Mike,
I’m really sorry about this bug! And that I didn’t see it myself!
The “organizer” label isn’t quite hard-coded there, it’s still fully translatable, but it should be calling in the organizer label dynamically for our filter to work. Here’s how to replace that to get the code I recommended to work:
<?php if ( isset( $organizer ) && $organizer && tribe_get_organizer() != '' ): ?><span class="tribe-organizer">
<?php echo esc_html( sprintf( __( '%:', 'tribe-events-calendar-pro' ), tribe_get_organizer_label_singular() ) ); ?>
<?php echo tribe_get_organizer_link(); ?>
</span><?php endif ?>
Let me know if this helps! I will make a ticket for our developers to fix this immediately.
September 24, 2015 at 7:57 am #1008319MIKE
ParticipantThanks George! While you’re at it, let them know it exists in the event calendar as well in src/Tribe/Admin/Organizer_Chooser_Meta_Box.php, line 142
/** * Renders the "Add Another Organizer" button * * @return void */ protected function render_add_organizer_button() { printf( '<tfoot><tr><td colspan="2"><a class="tribe-add-organizer" href="#">%s</a></td></tr></tfoot>', __( 'Add another organizer', 'the-events-calendar' ) ); }Keep up the good work!
September 25, 2015 at 7:19 am #1008688George
ParticipantThank you for reporting this one, too, @MIKE!
Much appreciated – I’m sorry that these things aren’t fixed, but I will indeed add this second one to the development ticket and we’ll have them patched up quick! 🙂
Cheers,
GeorgeP.S.
If you would like to manually fix this second bug for now, you can do so by replacing it with code like this:
/**
* Renders the "Add Another Organizer" button
*
* @return void
*/
protected function render_add_organizer_button() {
echo '' . sprintf( __( 'Add another %s', 'the-events-calendar' ), tribe_get_organizer_label_singular() ) . ' ';
}
-
AuthorPosts
- The topic ‘Functions aren't changing labels or words in the List Widget’ is closed to new replies.
