change heading text in event-bar

Home Forums Calendar Products Events Calendar PRO change heading text in event-bar

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1024815
    Matthew
    Participant

    Hi,

    I’m trying to change the placeholder label in the search bar from “Location” to “Enter City or Zip” because it returns no events if you enter the state.

    I found this thread:

    How to change heading text in event-bar

    I altered it and entered this:

    function event_bar_modify_placeholder_text( array $filters ) {
    foreach ( $filters as &$single_filter ) {
    $single_filter[‘html’] = str_replace(
    ‘placeholder=”Location”‘,
    ‘placeholder=”Enter City or Zip”‘,
    $single_filter[‘html’] );
    }

    return $filters;
    }

    add_filter( ‘tribe-events-bar-filters’, ‘event_bar_modify_placeholder_text,

    I added the snippet to my site plugin (where I add any custom functions) and I got this error:

    Parse error: syntax error, unexpected ”event_bar_modify_placeholder_’ (T_ENCAPSED_AND_WHITESPACE) in /home/content/p3pnexwpnas10_data01/74/2764374/html/wp-content/plugins/physiocourse-plugin/physiocourse-plugin.php on line 433

    It seems to suggest the snippet is not finished. I tried to finish it with ); but that did not help. I also tried just the original snippet that was to change the date placeholder but the same thing happened.

    My apologies, I’m not code literate but I don’t want to pay a developer for a simple change in the text if I can avoid it 🙂

    Thanks in advance
    Mat

    #1024933
    Brook
    Participant

    Howdy Matthew,

    Good question. That is a bit of an old snippet for adjust the text. We have an update method that is a bit simpler. You should be able to just copy/paste the following code to change that text:
    [php]
    /*
    * EXAMPLE OF CHANGING ANY TEXT (STRING) IN THE EVENTS CALENDAR
    * See the codex to learn more about WP text domains:
    * http://codex.wordpress.org/Translating_WordPress#Localization_Technology
    * Example Tribe domains: ‘tribe-events-calendar’, ‘tribe-events-calendar-pro’…
    */
    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(
    ‘Location’ => ‘Enter City or Zip’,
    );

    // If this text domain starts with "tribe-", and we have replacement text
    if(strpos($domain, ‘tribe-‘) === 0 && array_key_exists($text, $custom_text) ) {
    $text = $custom_text[$text];
    }

    return $text;
    }
    add_filter(‘gettext’, ‘tribe_custom_theme_text’, 20, 3);[/php]

    Does that all make sense? Will that work for you? Please let me know.

    Cheers!

    – Brook

    #1025102
    Matthew
    Participant

    That worked nicely,

    thanks Brook

    #1025491
    Brook
    Participant

    Excellent! Thanks for letting me know.

    Cheers!

    – Brook

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘change heading text in event-bar’ is closed to new replies.