conflict with "gettext"
-
There’s a conflict with gettext. Google Maps doesn’t show up in this div:
Here’s the div:
<div class="tribe-events-venue-map"> <div id="tribe-events-gmap-Related Programs" style="height: 350px; width: 100%"></div><!-- #tribe-events-gmap-Related Programs --> </div>
The “Related Programs” part is coming from my filter to translate some unrelated text.
Here’s the filter:
add_filter( 'gettext', 'translated_strings', 20, 3 );
Here’s the function “translated_strings” or, part of it:
function translated_strings( $translated_text, $text, $domain ) { switch ( $translated_text ) { case 'Related Products' : $translated_text = __( 'Related Programs', 'woocommerce' ); break; } return $translated_text; }
When I disable the above filter, everything works great. I also just hard coded the div like this in the map.php file:
<div id="tribe-events-gmap-0" style="<?php esc_attr_e( $style ) ?>"></div><!-- #tribe-events-gmap-<?php esc_attr_e( $index ) ?> -->
And it works. But, it’s not a solution that I can live with for long term.
What’s the problem? How can it be fixed?
- The topic ‘conflict with "gettext"’ is closed to new replies.