Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.1.1, Bio Entry Card, map
- This topic has 3 replies, 2 voices, and was last updated 9 years, 2 months ago by
Steven Zahm.
-
AuthorPosts
-
09/11/2014 at 5:37 pm #303692
Marco Eisenack
ParticipantHello Steve,
I need to display the Google Map in the Bio Entry Card. Copying this from the card.php didn’t work in the Bio Entry template.
<div class="cn-right"> <?php if ( $atts['enable_map'] ) { $gMap = $entry->getMapBlock( array( 'height' => $atts['map_frame_height'] , 'width' => ( $atts['map_frame_width'] ) ? $atts['map_frame_width'] : NULL , 'return' => TRUE , 'zoom' => $atts['map_zoom'] ) ); if ( ! empty( $gMap ) ) { $mapDiv = '<div class="cn-gmap" id="map-container-' . $entry->getRuid() . '" style="display: none;">' . $gMap . '</div>'; printf( '%2$s', $entry->getRuid(), $atts['str_map_show'], $atts['str_map_hide'] ); } } if ( ! empty( $gMap ) && $atts['show_return_to_top'] ) { echo '<span class="toggle-map-divider"></span>'; } if ( $atts['show_return_to_top'] ) { ?> <!-- <span class="cn-return-to-top"><?php cnTemplatePart::returnToTop() ?></span> --> <?php } ?> ➤ </div>
Any solutions to that?
Best regards!
09/13/2014 at 7:24 pm #303866Steven Zahm
Keymaster@ Marco
You also need the javascript from the template you’ve copied this from. You also need to make to to call this:
wp_enqueue_script( 'jquery-gomap' );
You should not do this from within the template because it only needs called once. Putting it in the template will call it each time an entry is displayed. Here’s the code:
// Register the required JS file. add_filter( 'cn_template_required_js-cmap', 'marco_enqueue_gomap' ); function marco_enqueue_gomap( $required ) { $required[] = 'jquery-gomap'; return $required; }
Hope that helps!
09/16/2014 at 8:18 am #304179Marco Eisenack
ParticipantHello Steve,
I’m afraid that I dont’t know exactly what to do with the code you posted.
I created a code snippet and pasted the “//Register the required JS file.” in it. Then pasted the map code (see my post) in the card-bio.php but don’t know what to do with
wp_enqueue_script( 'jquery-gomap' );
exactly?
Best regards!
09/16/2014 at 11:21 am #304214Steven Zahm
Keymaster@ Marco
There’s a lot of moving pieces to add a working map, honestly, it hard to tell what exactly is wrong or yet needs to be done.
May it would be easier for you to tweak the template that you have which does have the map? I know you want to add the map to the Bio Entry Card … but what wrong with the template that already has the map? It does everything the Bio Entry Card, plus more.
But to try to answer you question…
Looks like the snippet I gave you has a copy/paste error, use this:
// Register the required JS file. add_filter( 'cn_template_required_js-card-bio', 'marco_enqueue_gomap' ); function marco_enqueue_gomap( $required ) { $required[] = 'jquery-gomap'; return $required; }
Forget about adding
wp_enqueue_script( 'jquery-gomap' );
, I think, but you can add it to the__construct
method in thecard-bio.php
file.You still need the map JavaScript code from the source template. and past it in a file named
card-bio.js
.There’s quite a bit of code in the source template javascript file that relates to the map. It also very likely you’ll have to tweak that code to work with the Bio Entry Card.
Hope that helps!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.