We'd like to have markers for multiple post types to appear on one map. That was possible when I tried for two markers of different post types, but the number could go up to 10 or more for us.
This is the code I used to display two different markers of two post types on one map:
Would similar code work if we add 10 more markers (each from a different post type) without performance issues? Is there a limit to the number of different post type markers we can/should have in one map?
Let's say you have ten different post types, e.g. hotels, restaurants, museums, shops etc...
You want to display all of them on a single map.
Each post type has an address field.
You create a View and in the Content Selection section to check each of your ten post types.
So now this View is querying the database for all of these post types and returning a mix of them, according to the details of your View.
Then in the output section you add your map.
If each of these post types uses the same address field (e.g. "location"), then you just insert one marker shortcode for that field.
The View will iterate over ("loop" over) the matching posts (of varying types), and for each one add the marker with an address coming from the "location" field.
If some of the post types use a different address field (e.g. "place"), then you would use conditional shortcodes that test for the post type to determine whether you should add a marker for "location" or a marker for "place".
Likewise if you wanted to use different custom markers depending on the post type.