Tell us what you are trying to do? I have a custom post with a custom field (Maps).. I've added 2 addresses in the custom fields (multiple instances are allowed for this field).. and then I followed instruction as per your tutorial.. but I am confused about the id that is created.. do I have to add something here or use the auto generated one? I would have expected the addresses that I have updated to show up but instead I get a Google Map display (once I have inserted the shortcode) but there's no markers..
Is there any documentation that you are following?https://toolset.com/documentation/user-guides/maps/display-on-google-maps/#api-key
Is there a similar example that we can see? hidden link
What is the link to your site? hidden link
Hello,
For the multiple instance custom field, please try [wpv-for-each] shortcode, for example:
[wpv-for-each field="wpcf-maps"]
Here display the marker shortcode ...
[/wpv-for-each]
More help:
https://toolset.com/documentation/user-guides/custom-content/repeating-fields/#Displaying%20Repeating%20Fields
Hi Luo Yang
Thanks for the prompt response and update.. really appreciate it...:-)..
I think I was not clear about my requirement.. Sorry.. let me explain it again..
It's not about multiple instances (but will need that later too)... it's about a single instance.. I am not able to understand how to show the marker in the google map that's displayed.. I have added an address and I assumed it would automatically show..
That's why I want to know if there is something I am not doing that I need to do... I've added address and in the post editor I have inserted the short code that's generated to add Map.. it provided a default id and I accepted it.. do I need to do more?
Because with this, I didn't get the marker in the front end..
Regards,
Alim
I have checked the URL you mentioned above:
hidden link
There is a JS error:
Google Maps JavaScript API warning: NoApiKeys
Please follow our document to setup the Google map API key in your website:
https://toolset.com/documentation/user-guides/maps/display-on-google-maps/creating-a-google-maps-api-key/#creating-an-api-key-for-google-maps
Then add a Toolset Map block, and setup the marker as "Dynamic source", see screenshot marker-source.JPG
Hi Luo Yang
Thanks for the prompt response and update..:-)..
The API for Google was all in place.. I double checked this.. But I think I got what I was doing wrong.. I was not using a content template.. but just putting the shortcode into the Post Body and expecting it to work.. it won't work like this.. right?
Anyways I have created the CONTENT TEMPLATE and now it's like this..
hidden link
The White Space on the right in desktop view (which would have shown a featured image if I add one) and the YE OPTICIAN above the slider are part of the theme's single.php... when I wanted some posts not to use this format I had created a single-optician-profile.php (another template for regular posts) which I was using before Toolset for optician profiles I created as regular posts... here's a link to how they appear.
hidden link
Now with the CONTENT TEMPLATE, it seems it is creating the template as something within single.php.. how do I edit this template to remove the features of single.php or maybe if possible, I'd like the CONTENT TEMPLATE to use the single-optician-profile.php (another template for regular) so that the featured-image and the other aspects are removed for the custom posts.
Please do advise. I am beginning to like Toolset..:-).. it's really amazing..:-)..
Regards,
Alim
Dear Alim
Q) but just putting the shortcode into the Post Body and expecting it to work.. it won't work like this.. right?
It should be able to work in WordPress Blocks Editor, the screenshot I provided above is taken from a normal post and post content of a fresh WordPress installation.
I suggest you check the compatibility issue in your website:
please deactivate all other plugins, and switch to wordpress default theme 2020, and test again
According to our support policy, we prefer to one ticket one question, for your other new questions, please check the new thread here:
https://toolset.com/forums/topic/id-like-the-content-template-to-use-the-single-optician-profile-php/
It should be able to work in WordPress Blocks Editor, the screenshot I provided above is taken from a normal post and post content of a fresh WordPress installation.
I use the classic editor.. would that be different? I'll try and test on block editor... you mean Gutenberg Editor.. right?.. I also have WP Bakery but rarely use that.. I prefer the Classic Editor for most of my work (still very old-school, I guess!!)..;-)..
Regards,
Alim
Yes, you are right, I mean the Gutenberg editor, for classic editor, please try to follow our document to setup the map and marker shortcode:
https://toolset.com/documentation/user-guides/maps/display-on-google-maps/
Hi Luo Yang
I was trying to follow the instructions as per your link and here's the image that suggests what I should do
https://toolset.com/wp-content/uploads/2018/07/toolset-maps-map-id-805x412.png
Now in this image the Mad ID is displayed automatically and that's exactly what's happening on mine as well.. so I got this shortcode and pasted it in the Post-Content
[wpv-map-render map_id="map-4"][/wpv-map-render]
Now if you notice I have 2 addresses in the post .. the map below in the link will show you the 2 markers (they were added by the content template method)
hidden link
but the map above in the POST-CONTENT has the short-code with the map_id as "map-4" (I am not sure what and how this is generated).. but how do I put the markers from a dynamic source (from the post's address)
Please advise.
Regards,
Alim
In classic editor, there isn't "dynamic source" option, for example you can setup the map + marker shortcode as below, and test again:
[wpv-map-render map_id="my-map" map_width="400px" map_height="200px" fitbounds="off" general_zoom="6" single_zoom="15" cluster="on"]
[wpv-map-marker map_id="my-map" marker_id="my-marker" marker_title="This is a marker" marker_field="wpcf-maps"]This is the content of the marker popup.[/wpv-map-marker]
More helps:
https://toolset.com/documentation/user-guides/maps/maps-shortcodes/#wpv-map-render
https://toolset.com/documentation/user-guides/maps/maps-shortcodes/#wpv-map-marker
Hi Luo Yang
Thanks for the update..:-)..
So basically it's not a good idea to try and do this with classic editor.. it's much easier and better with Gutenberg.. right?
I still didn't quite get how you would get the marker id as the map-id would be auto-generated but the link you provided didn't give much insight into how I would get the marker-id.. anyways I'll just wait for your confirmation for this mail and close this topic..:-)..
Thanks for all your support.. really appreciate it.
Regards,
Alim
You can get the map ID value when you setup map shortcode for example:
map shortcode [wpv-map-render map_id="my-map" ...] , as you can see the map ID value is "my-map"
Then use the same map ID value in marker shortcode: [wpv-map-marker map_id="my-map" ...]
So the map ID value depends on your map shortcode, since you did not provide details for how do you setup the map shortcode, I am not sure which map ID are you using.
Hi Luo Yang
I am sorry but I think I wasn't clear.. it's not the map id I can't generate.. that's easy.. it's auto-generated.. I am not clear about how to generate the marker id
This part is what's confusing me..
Regards,
Alim
Please check the document I mentioned above:
https://toolset.com/documentation/user-guides/maps/display-on-google-maps/#displaying-the-map
section "Displaying a Map"
If you need more assistance for it, please provide a test site with the same problem, also point out the problem page URLs, I can setup a demo for you, thanks
My issue is resolved now. Thank you!
I was only inserting the 'map' from the 'Views & Fields' button... I didn't realise that I had to add a 'marker' separately as a shortcode and that was the cause for all my confusion..;-).. My apologies for this. Thanks once again for your patience.
Regards,
Alim