Home › Forums › Calendar Products › Community Events › How to show map by default?
- This topic has 7 replies, 2 voices, and was last updated 11 years, 6 months ago by
Brian.
-
AuthorPosts
-
September 11, 2014 at 10:09 am #738162
persyst
ParticipantHow can I have the “Show Google Map” and “Show Google Maps Link” boxes checked by default when creating a new event?
September 12, 2014 at 5:49 am #739820Brian
MemberHello persyst,
I can help you out with this.
You are asking to have Show Google Map” and “Show Google Maps Link” checked on the edit screen correct? And not on the Community Events Front End Calendar?
For the backend editor as long as I have this setting checked in the Events settings: “Enable Google Maps.” Both those fields are checked for me when creating a new event. Is that not the case of you?
Community Events
For the Community Events I found this example from another topic:Does that help? Let me know if you would like some more information or I was not correct in understanding your question.
Thanks
September 12, 2014 at 7:42 am #739968persyst
ParticipantHi Brian,
The back-end works as you described. I would like the front-end (community events) to work the same way. Would it be possible for you to please spare me the torture of reading through that back-and-forth-convo from the Community Events posts, and tell me exactly how to have the Map Boxes “checked” by default on the “Add Community Events” page?And as an additional option, I would like to remove the map boxes completely from the “Add Community” page, but still have them defaulted to being “checked”.
Thanks
September 15, 2014 at 7:19 am #744652Brian
MemberHi persyst,
I can take a quick look for you and give you the next step, I do not think it is that much torture, usually I would just skip to the end anyway to find the answer. 🙂
There are two lines of coding you will need to change in this file after you move it to your theme:
views\community\modules\venue.php
<input type="checkbox" id="EventShowMapLink" name="EventShowMapLink" value="1" <?php checked( get_post_meta( $event, '_EventShowMapLink', true ) ); ?> /><input type="checkbox" id="EventShowMap" name="EventShowMap" value="1" <?php checked( tribe_embed_google_map( $event ) ); ?> />
For both all you need to add this inside the input:
checked="checked"So it will look like this:
<input type="checkbox" checked="checked" id="EventShowMapLink" name="EventShowMapLink" value="1" <?php checked( get_post_meta( $event, '_EventShowMapLink', true ) ); ?> />
Then they will show as checked by default.
Remove the Map
I think the best thing to do is add some css to hide the map box, but still leave it checked when hidden. When you are editing the files above you can use an inline style of display:none to hide the whole venue box or part of the box you would like.Does that work?
PS I am moving this to the Community Events Forum since your question relates to that Add On.
September 15, 2014 at 9:17 am #744857persyst
ParticipantThanks Brian, I made the following changes with the checkbox and added in:
<div style=”display:none”> </div> to hide the boxes and text, but I had to add this in four times as shown below, to hide all the boxes and text. Is there a cleaner way to do this than what I did. Also, while this did hide everything on the Add Community Event page, the map does not actually get displayed on the event page when viewing. Do I need to put the “display:none” fields in a different location?<?php if ( !tribe_community_events_is_venue_edit_screen() ) { ?>
<tr id=”google_map_link_toggle”>
<td>
<div style=”display:none”><label for=”EventShowMapLink”>
<?php _e( ‘Show Google Maps Link’,’tribe-events-community’ ); ?>:</div>
</label>
</td>
<td>
<div style=”display:none”><input type=”checkbox” checked=”checked” id=”EventShowMapLink” </div> name=”EventShowMapLink” value=”1″ <?php checked( get_post_meta( $event, ‘_EventShowMapLink’, true ) ); ?> />
</td>
</tr><!– #google_map_link_toggle –><?php if( tribe_get_option( ’embedGoogleMaps’, true ) ) : ?>
<tr id=”google_map_toggle”>
<td>
<div style=”display:none”><label for=”EventShowMap”>
<?php _e( ‘Show Google Map’, ‘tribe-events-community’ ); ?>:</div>
</label>
</td>
<td>
<div style=”display:none”><input type=”checkbox” checked=”checked” id=”EventShowMap” </div> name=”EventShowMap” value=”1″ <?php checked( tribe_embed_google_map( $event ) ); ?> />
</td>
</tr><!– #google_map_toggle –><?php endif; ?>
September 15, 2014 at 9:36 am #744877persyst
ParticipantShould I use something like the code below instead? If so, could you tell me which lines to include when pasting this in?
Thanks
<style>
h1.hidden {
display: none;
}
</style>
</head>
<body><h1>This is a visible heading</h1>
<h1 class=”hidden”>This is a hidden heading</h1>
<p>Notice that the hidden heading does not take up space.</p></body>
</html>September 16, 2014 at 9:41 am #746494Brian
MemberAdding those divs like that is one way to do it. I do not see why doing it with another method on that page would make much of a difference.
You maybe able to add the div around the if statement to hide everything, such as:
<div style=”display:none”>
<?php if ( !tribe_community_events_is_venue_edit_screen() ) { ?>//... coding here
<?php endif; ?>
</div>Also for that second input the coding shows the closing tag </div> in the middle of the input. That could be causing the issue of the map not showing.
The coding you added on the Community Add Event page is inline so it should not hide on the single event.
I think it is close so if you play around with it just a little more it should get it to how you would like it.
Thanks
October 2, 2014 at 5:58 am #782786Brian
MemberThis thread’s not seen much activity for the last couple of weeks – and there’s not too much more we can offer here given its a customization – so I’ll go ahead and close it. Of course if you still need help with this or any other issue please don’t hesitate to create a new thread (or threads) and one of the team will be only too happy to help. Thanks!
-
AuthorPosts
- The topic ‘How to show map by default?’ is closed to new replies.
