Home › Forums › Calendar Products › Events Calendar PRO › Change Template tag for Google Maps
- This topic has 6 replies, 3 voices, and was last updated 10 years, 2 months ago by
Support Droid.
-
AuthorPosts
-
January 15, 2016 at 1:29 pm #1056815
Shea
ParticipantMy goal is to change the text for the maps link. I have looked through the Themer’s Guide and haven’t seem how to do this. I have found the code in functions/template-tags/google-map.php on line 47. I tried copying the function and placing it in my functions.php, but that just throws an error saying that the function was already created. What is the best way for me to make this change? I know that there should be a way around editing the plugin file. Thanks for the help I appreciate it.
January 15, 2016 at 2:19 pm #1056838Ronald
ParticipantHi Shea,
I believe I can help you out with this.
You are correct that you don’t want to copy the function and put it into functions.php but I do believe you are looking in the right place.
If I can ask you a quick question, what text is it that you want to change? Is it: ‘Click to view a Google Map’? If so, it is in the functions/template-tags/google-map.php on line 46 (right where you were looking), You can change it there with no issues. If it is other text, let me know!
Thanks,
Ron
January 18, 2016 at 5:51 am #1057626Shea
ParticipantHi Ron,
I actually want to change the ‘+ Google Map’ text that is on line 47. I must have grabbed the wrong line number before. If I change the text there, what will happen when the update gets run on the plugin? Would I lose those text changes? If possible I would like to avoid having to make those changes everytime I update.
Thanks for the help.
January 18, 2016 at 6:23 pm #1058239Ronald
ParticipantHi Shea,
There are a couple possible solutions to this. The first is to change it where we discussed, but as you guessed, this will be overwritten when you update. Another option is to add a snippet to your themes functions.php file. This is what you would add:
%s‘,
esc_url( tribe_get_map_link( $postId ) ),
esc_html__( ‘Click to view a Google Map’, ‘the-events-calendar’ ),
‘MY NEW STRING!’);
return $html;
}?>
This is untested but I think you get the idea?
January 19, 2016 at 7:46 am #1058686Shea
ParticipantHi Ronald,
That is awesome! With a little tweaking I was able to get the code to work. Here is the working code:
add_filter( 'tribe_get_map_link_html', 'override_tribe_get_map_link_html' ); function override_tribe_get_map_link_html( $html ) { $html = sprintf( '<a class="tribe-events-gmap" href="%s" title="%s" target="_blank">%s</a>', esc_url( tribe_get_map_link( $postId ) ), esc_html__( '+ Google Map', 'the-events-calendar' ), 'map' ); return $html; }Thanks so much for the help. I really appreciate it.
January 25, 2016 at 9:29 am #1061935Ronald
ParticipantNo problem Shea! I’m glad I could help, and thanks for your help!
February 20, 2016 at 8:35 am #1078841Support Droid
KeymasterThis 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. -
AuthorPosts
- The topic ‘Change Template tag for Google Maps’ is closed to new replies.
