Skip Navigation

[Gelöst] Displaying a pronamic map from a child post

This support ticket is created vor 8 Jahre, 4 Monate. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 8:00 – 17:00 -
- - - - - - -

Supporter timezone: America/Sao_Paulo (GMT-03:00)

This topic contains 11 Antworten, has 2 Stimmen.

Last updated by Adriano vor 8 Jahre, 3 Monate.

Assigned support staff: Adriano.

Author
Artikel
#247293

Hello, I'm having problems displaying a map created with the plugin pronamic google maps from a child post.

I have a type of parent post named "lugar" (created with types) with five fields: four of them created with wp-types and one of them created with Pronamic Google Maps. When I try to display all the fields from this parent post in a child post I can do it with fields "lugar", "direccion", "comuna" and "web" (all of them fields created with types) but not in the case of the map, using the same logic than for the other fields.

This is the code

<?php echo types_render_field("lugar", array('style' => 'text',"post_id"=>'$lugar')) ?>
<?php echo types_render_field("direccion", array('style' => 'text',"post_id"=>'$lugar'));?>
<?php echo types_render_field("comuna", array('style' => 'text',"post_id"=>'$lugar'));?> <
<?php echo types_render_field("web", array('style' => 'text',"post_id"=>'$lugar'));?>
<?php

if ( function_exists( 'pronamic_google_maps' ) ) {
pronamic_google_maps(
array('width' => '100%', 'height' => 200, "post_id"=>'$lugar) );
}
?>

Another question in the same code is, how can I convert one of the fields in a link to the parent post?

Thanks in advance

#247551

That's because in Types we accept "$post_type_slug" as argument to render a field. But this plugin you are using doesn't (pronamic google maps). So this is not a problem with Types, but with pronamic google maps. There is not we can do. I would recommend you to contact the author of this plugin.

Please let me know if you are satisfied with my answer and if I can help you with any other related question.

#247605

Thanks for your reply, Adriano

How you said that it is not possible do this with pronamic plugin, I was trying to create a google map in a type of posts following the instructions in https://toolset.com/documentation/user-guides/map-wordpress-posts/. But I can't get show a single map.

I show you the code in the content template:

Content:

[types field="direccion" show_name="true" ] [/types]
[types field="comuna" show_name="true"][/types]
[types field="web" target="_blank" show_name="true"][/types]
<div id="js-map-element" data-marker-title='[wpv-post-title]' data-marker-lat='[types field="latitud"][/types]' data-marker-lon='[types field="longitud"][/types]'>
[wpv-view name="eventosxlugar"]

JS

jQuery( document ).ready(function($) {
$("#js-main-map-canvas").wpvmap({
mapType : google.maps.MapTypeId.TERRAIN
});
});

And the maps is not displaying... What i'm doing wrong?

Thanks a lot!

#247884

I need to request temporary access (wp-admin and FTP) to your site - preferably to a test site where the problem has been replicated if possible - in order to be of better help. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

#247892

Thanks Adriano,

The content template when I'm trying to display the map created with types is in "Lugar"

#248575

I can not log there, getting the following fatal error:

Fatal error: Cannot redeclare mysql2date() (previously declared in /xxx/wp-includes/functions.php:26) in /xxx/wp-content/themes/bucket-child/functions.php on line 42

Please fix that and let me know when I can look to it.

#248690

Excuse me, Adriano. Today I had some problems with the web. But now is working again

#249246
JS conflict.png

I've fixed your Content Template, but there is a conflict in your website. If you look the JS console bar (attached image), you will notice the Google maps is being called twice. You must fix that to make it works.

#250160

Hello, Adriano

I'm doing tests with the code you wrote in a different domain with other theme (which doesn't have google maps incorporated and without other google maps plugin installated) and the map doesn't display again. This is the link: hidden link

Thanks in advance

#250710

The map was there but hidden. So, I've just defined a fixed height to the DIV's map and it worked:

#js-main-map-canvas{
    height: 260px;
}

Please let me know if you are satisfied with my answer and if I can help you with any other related question.

#250750

Thank you very much, Adriano

It works perfectly. In the post and in a child post too.

Excellent plugin and support!

#250892

You are welcome