Skip Navigation

[Resolved] Map shows markers when there is one result, but not when there are two results

This support ticket is created 7 years, 6 months ago. 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.

This topic contains 2 replies, has 2 voices.

Last updated by leeF-2 7 years, 6 months ago.

Assisted by: Luis Sacristán.

Author
Posts
#515383
screenshot-1.jpg
screenshot-2.jpg

I have successfully added two new items into my CPT. These have proper taxonomy (categories) assigned to them - and both have one in common.

When I view the map and select one taxonomy that is unique to one of the CPTs, the map displays that item marker properly. However, when I either multi-select two different categories (each assigned to one of the CPTs) neither of the markers appear on the map but do appear in the list of found entries (in the loop). Same thing happens if I only select the one category that is common to both CPTs.. no markers, but they are in the list of found entries.

Screenshot 1 shows one of the markers being displayed on the map if only one category (that is unique to one CPT) is selected.

Screenshot 2 shows no markers, yet the category that is common to both CPTs is selected and both CPTs show in the found list.

#515685

Luis Sacristán
Supporter

Languages: English (English ) Spanish (Español )

Hi @leeF-2

Thanks for consulting Toolset Support
I will be happy to help you with your ticket

I have tested locally what you are trying to do and it works for me. Let me tell you what I have done.

I have created a WordPress archive for the taxonomy
Before the loop I have included the map
Inside the loop I have included the post title (or whatever you want to show) and the Google Maps marker attached to the post map field

Here is the code:

[wpv-map-render map_id="mapa1"]
[wpv-layout-start]
    [wpv-items-found]
    <!-- wpv-loop-start -->
    <ul class="wpv-loop js-wpv-loop">
        <wpv-loop>
            <li>
              [wpv-post-link]
              [wpv-map-marker map_id="mapa1" marker_id="marker-[wpv-post-id]" marker_field="wpcf-mapa"][/wpv-map-marker]
            </li>
        </wpv-loop>
    </ul>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
        <strong>[wpml-string context="wpv-views"]No items found!!!!![/wpml-string]</strong>
    [/wpv-no-items-found]
[wpv-layout-end]

In my example the Map field is named “mapa”

Please, read these links for further information:
https://toolset.com/documentation/user-guides/create-custom-taxonomies/
https://toolset.com/documentation/user-guides/#toolset-maps

Since it seems you have some custom code, I would like you to help me to duplicate your issue, so I can figure out what is going wrong with your code.

Regards
Luis

#516731

Hello Luis,

Thanks for that help. I did manage to figure out that the marker was being placed in the wrong portion of the loop.

Thanks very much.