maef
Forum Replies Created
-
Forum: Plugins
In reply to: [The Events Calendar] Google map not showingHow did I miss that function? Guess I just got tangled up in the theme instead of the plugin. That’s so much better and easier than what I did.
Immediately changed it to your code, thanks man.
Forum: Plugins
In reply to: [The Events Calendar] Google map not showingHi,
I ran into the same problem, and couldn’t just remove the API call in the footer since I used it on another page. I figured the best way to get it working was to use a conditional tag on the API call in the footer. Here are two quick and easy, albeit somewhat dirty fixes I came up with:
1st Method:
If you didn’t do that already, create a child theme. After copying the footer.php into your child theme, open it and find the line starting with:
<?php if(!$data['status_gmap']): ?><script type="text/javascript" [...]Modify the if clause:
<?php if(!$data['status_gmap'] && ! has_tag('gmap')): ?>Now, just tag any event that includes a Google Map with the tag “gmap”.
The advantage of this method is that it uses a child theme and will keep working when you update your theme. Also, you can use the tag on any post, not just events, so you can include Maps anywhere as long as you tag the post with “gmap”. The disadvantage is you have to remember to use the tag on every event manually or it won’t work.2nd Method:
You can use this code to make The Events Calendar submit events with the post type “events” instead of the default “post”.
After that, you use pretty much the same method as before, changing the conditional sentence to<?php if(!$data['status_gmap'] && ! ( 'events' == get_post_type() )): ?>The advantage here is that it’s automated and you can’t forget anything. It also adds the feature of having your events clearly defined as their own post type for any other possible modifications.
The negative aspect is that WordPress doesn’t offer child plugins like it does for themes, so you’ll have to make the changes to the post type in the plugin itself and they will be gone when it updates. Also, you can’t use this method to block the API call on regular posts.I used the first method myself, because I liked the flexibility of it working on other post types.