Skip Navigation

[Resolved] Weird issue with custom map markers

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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 7 replies, has 2 voices.

Last updated by Waqar 1 year ago.

Assisted by: Waqar.

Author
Posts
#2664163
Cap.jpg

Hello,

I have a very odd issue with custom map markers. I set this up some years ago and at the time it was working. I'm now updating the site in staging, with newer versions of Toolset and Elementor, and this issue has appeared:

I have a post type Destinations, which has the taxonomy types Locations and Destination Types. On the pages for the various locations I have maps that display custom markers for the various types, using a content template, see below.

However, I'm getting odd errors for some icons on some pages, so they don't display. Basically, it appears that <p></p> tags are being inserted into the icon URLs. I have no idea where this could be coming from. I've tried disabling non-essential plugins, clearing caches, etc.

You can see the issue here, for instance, where only two of four icons are displaying: hidden link (password: savour)

[wpv-conditional if="(has_term('craft-alcohol', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('dining', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('sweet-treats', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('maple-syrup', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('stay', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('attractions', 'destination-type', null) eq '1')"]hidden link;
[wpv-conditional if="(has_term('specialty-shops', 'destination-type', null) eq '1')"]hidden link;

#2664445

Hi,

Thank you for contacting us and I'd be happy to assist.

Looks like some characters are getting encoded, incorrectly, which is resulting in the wrong URL for the images.

To troubleshoot this, I'll need to see how this view and the markers are set up in the admin area. Can you please share temporary admin login details, in reply to this message?

Note: Your next reply will be private and making a complete backup copy is recommended before sharing the access details.

regards,
Waqar

#2664655

Correction, I'm now using the content template 'marker image 2'

#2664999

Thank you for sharing the admin access details.

I was able to fix this character encoding, by following these steps:

1. In the view 'Map View Location', I've updated the shortcode 'wpv-post-body' that loads the content template, so that it also includes the attribute suppress_filters="true":


[wpv-post-body view_template="marker image 2" suppress_filters="true"]

This way, third-party content filters are not applied to content coming from the template.
( ref: https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body )

2. In the content template 'marker image 2', I've removed the extra empty lines from the end of the content.

Note: There is still one challenge remaining though. The marker shortcode expects only a single image URL for the marker icon. But for one of the results, more than one image URLs are returning:

{yourwebsite.com}/staging/wp-content/uploads/2023/11/Stay.webp
{yourwebsite.com}/staging/wp-content/uploads/2023/11/Attraction.webp

You'll need to structure the conditional statements in the ''marker image 2'' template, so that only one of them can be true, for each loop item/result.

#2665101

Thanks very much, Waqar. I saw a short time ago that the problem seemed to be resolved. I also noticed the issue with the 'stay' and 'attractions' destination types you mention. I have one destination that is in both types -- what would the correct syntax be to say the following:

if="(has_term('stay', 'destination-type', null) eq '1')"
AND
if="(has_term('attractions', 'destination-type', null) eq '1')"]
THEN
hidden link

#2665413

Thanks for the update and glad that my message helped.

I noticed that the website is now using the template 'marker image' for the map marker icons.

Here is the code that I've updated, in it:


[wpv-conditional if="(has_term('craft-alcohol', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="(has_term('dining', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="(has_term('sweet-treats', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="(has_term('maple-syrup', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="(has_term('specialty-shops', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="NOT ((has_term('stay', 'destination-type', null) eq '1') AND (has_term('stay', 'destination-type', null) eq '1'))"]
[wpv-conditional if="(has_term('stay', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[wpv-conditional if="(has_term('attractions', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>
[/wpv-conditional]
[/wpv-conditional]
[wpv-conditional if="(has_term('stay', 'destination-type', null) eq '1') AND (has_term('stay', 'destination-type', null) eq '1')"]
<em><u>hidden link</u></em>	
[/wpv-conditional]

And here is the part that checks for the presence of two terms, for better clarity:


[wpv-conditional if="NOT ((has_term('stay', 'destination-type', null) eq '1') AND (has_term('stay', 'destination-type', null) eq '1'))"]
	[wpv-conditional if="(has_term('stay', 'destination-type', null) eq '1')"]
		<em><u>hidden link</u></em>
	[/wpv-conditional]
	[wpv-conditional if="(has_term('attractions', 'destination-type', null) eq '1')"]
		<em><u>hidden link</u></em>
	[/wpv-conditional]
[/wpv-conditional]

[wpv-conditional if="(has_term('stay', 'destination-type', null) eq '1') AND (has_term('stay', 'destination-type', null) eq '1')"]
	<em><u>hidden link</u></em>	
[/wpv-conditional]

It basically consists of two parts:

1. when presence of both terms is not true
In this case it checks for the existence of one of them and outputs the relevant image URL

2. when presence of both terms is true
In this case it outputs only the common image URL

#2665515

Thanks so much for your comprehensive reply, Waqar. Yes, I changed the content template because I inadvertently selected the Block Editor on the previous one, which caused problems and which I couldn't seem to undo. I am definitely not a fan of Gutenberg 🙂 Everything is working fine now.

#2665749

Gutenberg can be challenging at times 🙂

You're welcome to mark this ticket as resolved and start a new one for each new question or concern - we're here to help!