Theme conflict – any workaround possible?

Home Forums Calendar Products Community Events Theme conflict – any workaround possible?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1083002
    James
    Participant

    Hi,

    I had a problem with my google maps snippet not being visible but could not figure out why – see earlier thread: https://theeventscalendar.com/support/forums/topic/google-maps-snippet-not-showing/

    After a discussion with the theme developers it turned out to be caused by the inputting of the following code in to functions.php:

    function modify_bar_label( $translated_text, $text, $domain ) {
    switch ( $translated_text ) {
    case ‘Near’ :
    $translated_text = __( ‘Search By Postcode’, ‘tribe-events-calendar-pro’ );
    break;
    }
    return $translated_text;
    }
    add_filter( ‘gettext’, ‘modify_bar_label’, 20, 3 );

    This was done to change the text on the filter bar from ‘Near’ to ‘Search by postcode’ so that users could more easily understand what this part of the filter bar is for. Is there another code that would achieve the same effect which could be used? I am hoping to find a solution where I can change the text without the google maps snippet on each event disappearing.

    Many thanks

    James

    #1083281
    George
    Participant

    Hey James,

    I’m sorry to hear about these issues!

    The snippet shared here, that modify_bar_label() function, is just a gettext string replacement, so I am not sure why that broke things. At this time, there unfortunately is not a better way to go about changing that label with PHP, so we’ll have to try something else entirely.

    First, get rid of that snippet from your site if you haven’t already 🙂

    Next, try adding this snippet to your theme’s functions.php file or something:


    add_action( 'wp_footer', 'change_location_filter_label_text' );

    function change_location_filter_label_text() {

    if ( ! tribe_is_event() )
    return;
    ?>
    <script type="text/javascript">
    document.querySelector( '.label-tribe-bar-geoloc' ).textContent = 'Search by post code';
    </script>
    <?php
    }

    A true PHP solution would be better, but this above snippet should do the job for now until we are able to provide a simple filter or something here. Here’s an example of the above code snippet working well and changing that label text:

    I hope this code snippet helps!

    Sincerely,
    George

    #1089149
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Theme conflict – any workaround possible?’ is closed to new replies.