[Resolved] Should I add another custom post type to distinguish maps markers
This thread is resolved. Here is a description of the problem and solution.
Problem:
The user is using a map to display a custom post type posts with a custom marker. He would like to add similar posts and wonders if he needs to create a new custom post type and customize the marker.
Solution:
You can customize the marker for multiple post types or for the same post type. In this ticket, we used the solution to have another custom post type.
This support ticket is created 4 years 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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Now that I have the "Commercial Projects" set up -- I need another post for "Residential Projects". Do I need to duplicate everything I did for the Commercial Projects -- or is there a way I can change the post type to just "Projects" and maybe have a category set up for both Commercial Projects and Residential Projects? I need to be able to have 2 makers types on the map.
On our reference site, Real Estate Listings, we choose the first option and we customized marker per custom post type(apartment, house, land, etc.), check how we use [wpv-post-type] inside the marker_icon attribute:
So for your example using different custom post types -- I created a new custom post type called "Residential Projects"
Do I need to set up a view for Residential Projects? Or do I add the unique marker to the original map view (with the same map ID) I created (Commercial Projects)?
It depends on what do you want! If you want to have two maps, you will definitely need to create another view, on which, the map will have a different id.
If you want to display both custom post types ("Residential Projects" and "Commercial Projects") on the same view/map, just update the "Content Selection" of the view and select both custom post types.
Remember, that ID, for maps, markers, posts, divs, any element, is meant to be unique. That's why I suggested having a unique ID for each marker in my previous replies. Post ID, as an example, is always unique.
So I don't understand how I call for a different post type (Residential Projects). The view seems to be specific to the post you are calling... My thought is that I would duplicate the map marker in the loop and get it to pull from the Residential Projects posts... but I don't see how you do that.
Would you allow me temporary access to your admin area to check this view further? Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **
Please let me know which page to check? And which view?
Please confirm that you want to display both custom post types on the same map.
Also, elaborate more on how you want to customize markers? Do you want to use custom markers?
Please check this screenshot, Residential Projects must be added to the view hidden link
Then, there was an error on the markup shortcode, the marker shortcode was not closed with [/wpv-map-marker]. I fixed it.
I also updated marker_id='marker-4' to marker_id='marker-[wpv-post-id]'. As I explained earlier, there must be only one unique id 😉
Now, to distinguish between custom post types and assign a different marker icon per post type, we'll need to use conditional tags, I already added it to the view:
I will let you update the above code to use a different marker, basically, you will need to update "marker_icon" and "marker_icon_hover" for residential projects.
Jamal -- thanks for all the help -- it is much appreciated.
If I understand what you did correctly -- I just need to change the marker icon references to complete the look of the map. But if I preview the map right now (I haven't touched anything since you made changes) -- nothing shows up (no markers).