I have created a site using Toolset and Divi and found a strange issue :
I have built a template for a postype (thanks to Divi builder) and inserted the [wpv-post-id] shortcode.
Looking at the result, it seems that what is returned is not the ID of the post but the ID of the Divi Theme Builder Layout
Are you aware of this and what can I do to move forward as I need to retrieve the right info in this page.
Regards
Pat
It looks like the Divi Theme Builder is interfering with the global $post object which identifies the current post.
Instead of the Views shortcode, try registering this custom shortcode:
add_shortcode('postid', function ($atts = [], $content = null) {
global $post;
return $post->ID;
});
Then add that 'postid' shortcode to your template.
What does it output?
If it outputs the ID of the Divi Theme Builder Layout, then that's the problem, and it would only be Divi that can do something about that, you should report it to them.
Lots of 3rd party software would rely on the $post object being correct, not just Toolset.
That's far much better like this !
Thanks.
I still have an issue as I need to use the info inside a map and here is what I have placed as code in the Divi Template :
[wpv-map-render map_id="map-1" map_width="100%" map_height="300px" scrollwheel="off"][/wpv-map-render]
[wpv-map-marker map_id='map-1' marker_id='marker-6' address='[types field='localisation' item='[postid]'][/types]'][/wpv-map-marker]
I have also tried this as marker :
[wpv-map-marker map_id='map-1' marker_id='marker-7' marker_field='wpcf-localisation' item='[postid]'][/wpv-map-marker]
'localisation' is an address field that is integrated inside the post that is displayed thanks to the Divi template.
In both cases, nothing is displayed (the map is without marker).
Regards
Pat
Checking the documentation for the wpv-map-marker shortcode, it still lists id rather than item as the attribute to set the post from which the address field is pulled.
Without testing myself, you could try updating your shortcode to use the id attribute, like so:
If that doesn't work I would try the map on a page that you don't design with the Divi themer to verify that it works in that case, so that the problem can be narrowed down.
Thanks for your help.
I have tried to place it inside Divi builder without success.
I have also integrated it inside a post and got the same issue?
If I use a the post ID (ie : 1164) instead of the shortcode, then this is working !
Nigel is on holiday and will be back on 2nd January, so I'll be following up on this ticket.
Can you please share temporary admin login details, along with the details about the page/post and the template where you tested this map marker shortcode?
Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.
I can see the issue on your website, but couldn't reproduce this on my test website.
On my website, with the same Divi theme (4.0.6) I was able to get the correct current single post's ID using the "wpv-post-id" shortcode when used inside a text module in a theme builder template.
Not only that, the map and the marker also worked as expected without even passing the post ID.
This suggests that this issue is something specific to your website. I'll recommend testing this with all non-Toolset plugins temporarily disabled. If the issue is fixed, you can start adding the disabled plugins, one-by-one, to narrow down to a possible conflict.
I have looked at the template and currently, I'm able to display the address field (localisation) in the table above the button in the right), but the same field used as an address in the Toolset map marker does not works !
Thanks for the update and yes I also noticed the same strange behavior on your website.
( this is why I requested a clone/snapshot because the same can't be reproduced on a fresh install )
I've set your next reply as private and feel free to share the duplicator package, whenever you get a chance.
During testing on your website's clone and on my own website, I was only able to reproduce these issues, when I used the Divi theme's copy from your website.
Looks like some changes were added to the file(s) in the Divi theme folder.
To fix this, I'll recommend making a backup copy of your existing Divi theme folder and update it to the latest version (4.0.9) and this issue with the map marker and the incorrect post ID will be automatically fixed.
After that, if you'd like to add back any changes to the Divi theme files, you can create a child theme and then apply those changes through that ( the actual files in the parent theme folder shouldn't be edited, as they get overwritten, when theme updates ).
Here is a useful guide on the topic: versteckter Link
I hope this helps and please let me know how it goes.