Home › Forums › Calendar Products › Events Calendar PRO › Change label in search bar
- This topic has 7 replies, 4 voices, and was last updated 9 years, 5 months ago by
Kate.
-
AuthorPosts
-
October 13, 2016 at 12:31 pm #1176207
Kate
ParticipantI am trying to change the label in the search bar from “Search” to “Contains the word or name:”. I am following instructions found in other threads and added this snippet to my theme’s functions.php file:
// Translate labels in Events Calendar Pro search bar add_filter('gettext', 'theme_filter_text', 10, 3); function theme_filter_text( $translations, $text, $domain ) { // Copy and modify the following if {} statement to replace multiple blocks of text // Match the text you want you want to translate, preferably also match the text domain if($text === 'Search' && $domain === 'tribe-events-calendar') { // The custom text you want instead $text = 'Contains the word or name:'; } return $text; }It’s not having any effect. Does it belong in functions.php? Is the domain ‘tribe-events-calendar’ correct even if I am using the Events Calendar Pro? I have double checked the capitalization of the term I want to replace and it’s accurate. Thanks for any additional guidance you can offer.
October 13, 2016 at 3:17 pm #1176305Cliff
MemberHi Kate.
Could you please specify which of the 2 “search” words you’re trying to alter — https://cl.ly/0e1r3L292b0i — #1 or #2 or both?
October 14, 2016 at 11:16 am #1176732Kate
Participant#1. The label, not the placeholder. Thanks!
October 14, 2016 at 2:50 pm #1176880Cliff
MemberKate, that “Search” text is coming from this code: https://github.com/moderntribe/the-events-calendar/blob/4.3/src/Tribe/Main.php#L4437
Therefore, I believe your code is probably correct except for this part:
domain === 'tribe-events-calendar'It should be “the-events-calendar”, not “tribe-events-calendar”.
Please reference the current version of this code snippet at the end of this KB article: Change the wording of any bit of text or string
Thanks!
October 20, 2016 at 8:56 am #1179850Kate
ParticipantCliff, neither blocks of code (old or new) had any effect on my site. I edited the src file and that effected a change. But I need to find an update-safe way to make this same change. Can it only be made in functions.php, or is it possible to have a child copy of main.php in the theme’s custom tribe-events directory?
October 20, 2016 at 11:05 am #1180009Cliff
MemberPlease provide me the code snippet you currently have in your active theme’s functions.php?
(And, no, Main.php isn’t able to be overridden like that because it’s not a template/output file.)
November 11, 2016 at 8:35 am #1190920Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Change label in search bar’ is closed to new replies.
